diff options
Diffstat (limited to 'crawl-ref/source')
-rw-r--r-- | crawl-ref/source/libdos.cc | 9 | ||||
-rw-r--r-- | crawl-ref/source/libdos.h | 1 | ||||
-rw-r--r-- | crawl-ref/source/libw32c.cc | 9 | ||||
-rw-r--r-- | crawl-ref/source/libw32c.h | 1 |
4 files changed, 20 insertions, 0 deletions
diff --git a/crawl-ref/source/libdos.cc b/crawl-ref/source/libdos.cc index 86c7aec1b6..b105896ba9 100644 --- a/crawl-ref/source/libdos.cc +++ b/crawl-ref/source/libdos.cc @@ -33,3 +33,12 @@ bool is_cursor_enabled() { return (cursor_is_enabled); } + +// This will force the cursor down to the next line. +void clear_to_end_of_line() +{ + const int pos = wherex(); + const int cols = get_number_of_cols(); + if (pos <= cols) + cprintf("%*s", cols - pos + 1, ""); +} diff --git a/crawl-ref/source/libdos.h b/crawl-ref/source/libdos.h index b6fd3d6c05..72872acdd5 100644 --- a/crawl-ref/source/libdos.h +++ b/crawl-ref/source/libdos.h @@ -7,5 +7,6 @@ inline void enable_smart_cursor(bool ) { } inline bool is_smart_cursor_enabled() { return (false); } void set_cursor_enabled(bool enabled); bool is_cursor_enabled(); +void clear_to_end_of_line(); #endif diff --git a/crawl-ref/source/libw32c.cc b/crawl-ref/source/libw32c.cc index 09501eb5bd..7dc5b696e3 100644 --- a/crawl-ref/source/libw32c.cc +++ b/crawl-ref/source/libw32c.cc @@ -463,6 +463,15 @@ void _setcursortype_internal(bool curstype) gotoxy(cx+1, cy+1); } +// This will force the cursor down to the next line. +void clear_to_end_of_line() +{ + const int pos = wherex(); + const int cols = get_number_of_cols(); + if (pos <= cols) + cprintf("%*s", cols - pos + 1, ""); +} + void clrscr(void) { int x,y; diff --git a/crawl-ref/source/libw32c.h b/crawl-ref/source/libw32c.h index e4efd254c1..758b854e9e 100644 --- a/crawl-ref/source/libw32c.h +++ b/crawl-ref/source/libw32c.h @@ -22,6 +22,7 @@ void set_cursor_enabled(bool enabled); bool is_cursor_enabled(); void clrscr(void); +void clear_to_end_of_line(); void gotoxy(int x, int y); void textcolor(int c); void textattr(int c); |