summaryrefslogtreecommitdiff
path: root/console/display.c
diff options
context:
space:
mode:
Diffstat (limited to 'console/display.c')
-rw-r--r--console/display.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/console/display.c b/console/display.c
index 090aaf80..f6a24a8a 100644
--- a/console/display.c
+++ b/console/display.c
@@ -1593,23 +1593,38 @@ display_output_one (display_t display, wchar_t chr)
int line = (user->screen.cur_line + user->cursor.row)
% user->screen.lines;
int idx = line * user->screen.width + user->cursor.col;
+ int width, i;
+
+ width = wcwidth (chr);
+ if (width < 0)
+ width = 1;
if (display->insert_mode
- && user->cursor.col != user->screen.width - 1)
+ && user->cursor.col < user->screen.width - width)
{
/* If in insert mode, do the same as <ich1>. */
screen_shift_right (display, user->cursor.col,
user->cursor.row,
user->screen.width - 1, user->cursor.row,
- 1, L' ', display->attr.current);
+ width, L' ', display->attr.current);
+ }
+
+ if (display->attr.altchar)
+ chr = altchar_to_ucs4 (chr);
+
+ for (i = 0; i < width; i++)
+ {
+ if (user->cursor.col >= user->screen.width)
+ break;
+ user->_matrix[idx+i].chr = chr;
+ user->_matrix[idx+i].attr = display->attr.current;
+ user->cursor.col++;
+ chr |= CONS_WCHAR_CONTINUED;
}
- user->_matrix[idx].chr = display->attr.altchar
- ? altchar_to_ucs4 (chr) : chr;
- user->_matrix[idx].attr = display->attr.current;
+ if (i > 0)
+ display_record_filechange (display, idx, idx + i - 1);
- display_record_filechange (display, idx, idx);
- user->cursor.col++;
if (user->cursor.col == user->screen.width)
{
user->cursor.col = 0;