summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2009-10-23 17:07:18 +0000
committerTiago Cunha <tcunha@gmx.com>2009-10-23 17:07:18 +0000
commit2e39ab59d723abc6c1884d356e2b0d86a7b50cc4 (patch)
treed1953070fcb1f7d298599f0cfb1c1bf26a3700ad
parentac4e4a2b6c2b0ddef7614a38ed40307dd32bbaf6 (diff)
Sync OpenBSD patchset 415:
Don't print wide characters at screen width - 1. Matches uterm behaviour and is probably a better idea anyway.
-rw-r--r--screen-write.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/screen-write.c b/screen-write.c
index 8d2c2733..70592d18 100644
--- a/screen-write.c
+++ b/screen-write.c
@@ -1,4 +1,4 @@
-/* $Id: screen-write.c,v 1.78 2009-10-23 17:06:23 tcunha Exp $ */
+/* $Id: screen-write.c,v 1.79 2009-10-23 17:07:18 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -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);