summaryrefslogtreecommitdiff
path: root/console
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2011-03-06 04:04:04 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2011-03-06 04:07:25 +0100
commitbebc64a9a0f064a0e5f8a3549aa01aa9ac79a2e9 (patch)
tree45cb9b3db4160141c094adff1a305a9f3f525dd2 /console
parent7aa14de21f5521da75d8e42cbfc36a3300439cbc (diff)
Fix auto-margin support
* console/display.c (display_output_one): Allow user->cursor.col to become equal to width, add linefeed on next character insertion in such case.
Diffstat (limited to 'console')
-rw-r--r--console/display.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/console/display.c b/console/display.c
index 6b933144..26786c11 100644
--- a/console/display.c
+++ b/console/display.c
@@ -1590,9 +1590,18 @@ display_output_one (display_t display, wchar_t chr)
break;
default:
{
- int line = (user->screen.cur_line + user->cursor.row)
+ int line;
+ int idx;
+
+ if (user->cursor.col >= user->screen.width)
+ {
+ user->cursor.col = 0;
+ linefeed (display);
+ }
+
+ line = (user->screen.cur_line + user->cursor.row)
% user->screen.lines;
- int idx = line * user->screen.width + user->cursor.col;
+ idx = line * user->screen.width + user->cursor.col;
int width, i;
width = wcwidth (chr);
@@ -1625,10 +1634,10 @@ display_output_one (display_t display, wchar_t chr)
if (i > 0)
display_record_filechange (display, idx, idx + i - 1);
- if (user->cursor.col == user->screen.width)
+ if (user->cursor.col > user->screen.width)
{
- user->cursor.col = 0;
- linefeed (display);
+ user->cursor.col = 0;
+ linefeed (display);
}
}
break;