summaryrefslogtreecommitdiffstats
path: root/screen-write.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2009-10-17 08:32:18 +0000
committerNicholas Marriott <nicm@openbsd.org>2009-10-17 08:32:18 +0000
commitfe26b5d25fd9bfda2a787db1dc524c76004703dd (patch)
tree4d9dd88a27b63a0db8d78625ea87aa029bb18191 /screen-write.c
parent43d62c1ae3846ba1b33d79349be367ed3b6763cf (diff)
Don't print wide characters at screen width - 1. Matches uterm behaviour and
is probably a better idea anyway.
Diffstat (limited to 'screen-write.c')
-rw-r--r--screen-write.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/screen-write.c b/screen-write.c
index cb379a57..0cee126f 100644
--- a/screen-write.c
+++ b/screen-write.c
@@ -1006,6 +1006,14 @@ screen_write_cell(
} else
width = 1;
+ /*
+ * If this is a wide character and there is no room on the screen, for
+ * the entire character, don't print it.
+ */
+ if (width > 1 && (width > screen_size_x(s) ||
+ (s->cx != screen_size_x(s) && s->cx > screen_size_x(s) - width)))
+ return;
+
/* If the width is zero, combine onto the previous character. */
if (width == 0) {
if (s->cx == 0)
@@ -1037,14 +1045,6 @@ screen_write_cell(
return;
}
- /* If the character is wider than the screen, don't print it. */
- if (width > screen_size_x(s)) {
- memcpy(&tmp_gc, gc, sizeof tmp_gc);
- tmp_gc.data = '_';
- width = 1;
- gc = &tmp_gc;
- }
-
/* Initialise the redraw context, saving the last cell. */
screen_write_initctx(ctx, &ttyctx, 1);