From b8625a2bf5737b126dce5efbb44e6700e83c3c34 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Tue, 15 Oct 2002 09:30:16 +0000 Subject: [PATCH] Trim wide text properly at the RH edge of the screen. [originally from svn r2055] --- unix/pterm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/unix/pterm.c b/unix/pterm.c index e6446a03..58f9846e 100644 --- a/unix/pterm.c +++ b/unix/pterm.c @@ -1067,9 +1067,11 @@ void do_text(Context ctx, int x, int y, char *text, int len, } if (lattr != LATTR_NORM) { - if (x*2 >= cols) - return; x *= 2; + if (x >= cols) + return; + if (x + len*2 > cols) + len = (cols-x)/2; /* trim to LH half */ } gdk_gc_set_foreground(gc, &inst->cols[nbg]);