From aea7341eefa1fd2d1cc7d8ba8530510b5090c53a Mon Sep 17 00:00:00 2001 From: Kenny Root Date: Fri, 12 Feb 2010 05:40:56 +0000 Subject: Extra checking for scrolling wide characters git-svn-id: https://connectbot.googlecode.com/svn/trunk/connectbot@478 df292f66-193f-0410-a5fc-6d59da041ff2 --- src/de/mud/terminal/vt320.java | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/de/mud/terminal/vt320.java b/src/de/mud/terminal/vt320.java index a09deff..10fd231 100644 --- a/src/de/mud/terminal/vt320.java +++ b/src/de/mud/terminal/vt320.java @@ -1774,33 +1774,43 @@ public void setScreenSize(int c, int r, boolean broadcast) { c = map_cp850_unicode(c); /*if(true || (statusmode == 0)) { */ - if (insertmode == 1) { - if (isWide) { - if (C >= columns - 1) { - C = 0; - if (R == getBottomMargin() || R == rows - 1) + if (isWide) { + if (C >= columns - 1) { + if (wraparound) { + int bot = rows; + + // If we're in the scroll region, check against the bottom margin + if (R <= getBottomMargin() && R >= getTopMargin()) + bot = getBottomMargin() + 1; + + if (R < bot - 1) + R++; + else { + if (debug > 3) debug("scrolling due to wrap at " + R); insertLine(R, 1, SCROLL_UP); - else - R++; + } + C = 0; + } else { + // cursor stays on last wide character. + C = columns - 2; } + } + } + + if (insertmode == 1) { + if (isWide) { insertChar(C++, R, c, attributes | FULLWIDTH); insertChar(C, R, ' ', attributes | FULLWIDTH); } else insertChar(C, R, c, attributes); } else { if (isWide) { - if (C >= columns - 1) { - C = 0; - if (R == getBottomMargin() || R == rows - 1) - insertLine(R, 1, SCROLL_UP); - else - R++; - } putChar(C++, R, c, attributes | FULLWIDTH); putChar(C, R, ' ', attributes | FULLWIDTH); } else putChar(C, R, c, attributes); } + /* } else { if (insertmode==1) { -- cgit v1.2.3