From 17ef1051f3cc04438b923eb8183d61e292d8d1c1 Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Tue, 29 Sep 2009 09:36:52 +0000 Subject: [PATCH] - fix various bugs when display is scrolled up (#524503) --- xterm-248-scrollup.patch | 265 +++++++++++++++++++++++++++++++++++++++ xterm.spec | 7 +- 2 files changed, 271 insertions(+), 1 deletion(-) create mode 100644 xterm-248-scrollup.patch diff --git a/xterm-248-scrollup.patch b/xterm-248-scrollup.patch new file mode 100644 index 0000000..053fbe0 --- /dev/null +++ b/xterm-248-scrollup.patch @@ -0,0 +1,265 @@ +# ftp://invisible-island.net/xterm/patches/temp/xterm-248c.patch.gz +# patch by Thomas E. Dickey +# created Fri Sep 25 10:44:37 UTC 2009 +# ------------------------------------------------------------------------------ +# screen.c | 9 +++---- +# util.c | 69 ++++++++++++++++++++++++++++++++++--------------------- +# xterm.log.html | 24 ++++++++++++++++++- +# 3 files changed, 71 insertions(+), 31 deletions(-) +# ------------------------------------------------------------------------------ +Index: screen.c +--- xterm-248+/screen.c 2009-08-30 00:06:07.000000000 +0000 ++++ xterm-248c/screen.c 2009-09-25 00:08:26.000000000 +0000 +@@ -1,4 +1,4 @@ +-/* $XTermId: screen.c,v 1.396 2009/08/30 00:06:07 tom Exp $ */ ++/* $XTermId: screen.c,v 1.399 2009/09/25 00:08:26 tom Exp $ */ + + /* + * Copyright 1999-2008,2009 by Thomas E. Dickey +@@ -704,7 +704,8 @@ + if_OPT_WIDE_CHARS(screen, { + int kl; + int kr; +- if (DamagedCells(screen, len, &kl, &kr, INX2ROW(screen, row), col) ++ ++ if (DamagedCells(screen, len, &kl, &kr, row, col) + && kr >= kl) { + ClearCells(xw, flags, (unsigned) (kr - kl + 1), row, kl); + } +@@ -1156,7 +1157,7 @@ + assert(last > (int) n); + + if_OPT_WIDE_CHARS(screen, { +- int xx = INX2ROW(screen, screen->cur_row); ++ int xx = screen->cur_row; + int kl; + int kr = screen->cur_col; + if (DamagedCells(screen, n, &kl, (int *) 0, xx, kr) && kr > kl) { +@@ -1220,7 +1221,7 @@ + int kl; + int kr; + if (DamagedCells(screen, n, &kl, &kr, +- INX2ROW(screen, screen->cur_row), ++ screen->cur_row, + screen->cur_col)) + ClearCells(xw, 0, (unsigned) (kr - kl + 1), row, kl); + }); +@@ -1647,13 +1648,15 @@ + + TRACE(("ClearBufRows %d..%d\n", first, last)); + for (row = first; row <= last; row++) { +- LineData *ld = getLineData(screen, ROW2INX(screen, row)); +- if_OPT_DEC_CHRSET({ +- /* clearing the whole row resets the doublesize characters */ +- SetLineDblCS(ld, CSET_SWL); +- }); +- LineClrWrapped(ld); +- ClearCells(xw, 0, len, row, 0); ++ LineData *ld = getLineData(screen, row); ++ if (ld != 0) { ++ if_OPT_DEC_CHRSET({ ++ /* clearing the whole row resets the doublesize characters */ ++ SetLineDblCS(ld, CSET_SWL); ++ }); ++ LineClrWrapped(ld); ++ ClearCells(xw, 0, len, row, 0); ++ } + } + } + +Index: util.c +--- xterm-248+/util.c 2009-09-10 09:22:43.000000000 +0000 ++++ xterm-248c/util.c 2009-09-24 10:51:19.000000000 +0000 +@@ -1,4 +1,4 @@ +-/* $XTermId: util.c,v 1.489 2009/09/10 09:22:43 tom Exp $ */ ++/* $XTermId: util.c,v 1.496 2009/09/24 10:51:19 tom Exp $ */ + + /* + * Copyright 1999-2008,2009 by Thomas E. Dickey +@@ -744,7 +744,7 @@ + int scrolltop; + int scrollheight; + +- if (!ScrnIsLineInMargins(screen, INX2ROW(screen, screen->cur_row))) ++ if (!ScrnIsLineInMargins(screen, screen->cur_row)) + return; + + TRACE(("InsertLine count=%d\n", n)); +@@ -753,7 +753,12 @@ + HideCursor(); + + if (ScrnHaveSelection(screen) +- && ScrnAreLinesInSelection(screen, screen->top_marg, screen->bot_marg)) { ++ && ScrnAreLinesInSelection(screen, ++ INX2ROW(screen, screen->top_marg), ++ INX2ROW(screen, screen->cur_row - 1)) ++ && ScrnAreLinesInSelection(screen, ++ INX2ROW(screen, screen->cur_row), ++ INX2ROW(screen, screen->bot_marg))) { + ScrnDisownSelection(xw); + } + +@@ -820,7 +825,7 @@ + && !screen->whichBuf + && screen->cur_row == 0); + +- if (!ScrnIsLineInMargins(screen, INX2ROW(screen, screen->cur_row))) ++ if (!ScrnIsLineInMargins(screen, screen->cur_row)) + return; + + TRACE(("DeleteLine count=%d\n", n)); +@@ -828,14 +833,17 @@ + if (screen->cursor_state) + HideCursor(); + ++ if (n > (i = screen->bot_marg - screen->cur_row + 1)) { ++ n = i; ++ } + if (ScrnHaveSelection(screen) +- && ScrnAreLinesInSelection(screen, screen->top_marg, screen->bot_marg)) { ++ && ScrnAreLinesInSelection(screen, ++ INX2ROW(screen, screen->cur_row), ++ INX2ROW(screen, screen->cur_row + n - 1))) { + ScrnDisownSelection(xw); + } + + screen->do_wrap = False; +- if (n > (i = screen->bot_marg - screen->cur_row + 1)) +- n = i; + if (screen->jumpscroll) { + if (screen->scroll_amt >= 0 && screen->cur_row == screen->top_marg) { + if (screen->refresh_amt + n > MaxRows(screen)) +@@ -847,8 +855,25 @@ + FlushScroll(xw); + } + } +- if (!screen->scroll_amt) { + ++ /* adjust screen->buf */ ++ if (n > 0) { ++ if (scroll_all_lines) ++ ScrnDeleteLine(xw, ++ screen->saveBuf_index, ++ screen->bot_marg + screen->savelines, ++ 0, ++ (unsigned) n); ++ else ++ ScrnDeleteLine(xw, ++ screen->visbuf, ++ screen->bot_marg, ++ screen->cur_row, ++ (unsigned) n); ++ } ++ ++ /* repaint the screen, as needed */ ++ if (!screen->scroll_amt) { + shift = INX2ROW(screen, 0); + bot = screen->max_row - shift; + scrollheight = i - n; +@@ -876,6 +901,14 @@ + } + } + vertical_copy_area(xw, scrolltop + n, scrollheight, n); ++ if (shift > 0 && refreshheight > 0) { ++ int rows = refreshheight; ++ if (rows > shift) ++ rows = shift; ++ ScrnUpdate(xw, refreshtop, 0, rows, MaxCols(screen), True); ++ refreshtop += shift; ++ refreshheight -= shift; ++ } + if (refreshheight > 0) { + ClearCurBackground(xw, + (int) refreshtop * FontHeight(screen) + screen->border, +@@ -884,21 +917,6 @@ + (unsigned) Width(screen)); + } + } +- /* adjust screen->buf */ +- if (n > 0) { +- if (scroll_all_lines) +- ScrnDeleteLine(xw, +- screen->saveBuf_index, +- screen->bot_marg + screen->savelines, +- 0, +- (unsigned) n); +- else +- ScrnDeleteLine(xw, +- screen->visbuf, +- screen->bot_marg, +- screen->cur_row, +- (unsigned) n); +- } + } + + /* +@@ -1069,7 +1087,7 @@ + if (screen->scroll_amt) + FlushScroll(xw); + if ((height = screen->cur_row + top) > screen->max_row) +- height = screen->max_row; ++ height = screen->max_row + 1; + if ((height -= top) > 0) { + ClearCurBackground(xw, + top * FontHeight(screen) + screen->border, +@@ -1081,8 +1099,7 @@ + ClearBufRows(xw, 0, screen->cur_row - 1); + } + +- if (INX2ROW(screen, screen->cur_row) <= screen->max_row) +- ClearLeft(xw); ++ ClearLeft(xw); + } + + /* +Index: xterm.log.html +--- xterm-248+/xterm.log.html 2009-09-11 23:10:00.000000000 +0000 ++++ xterm-248c/xterm.log.html 2009-09-24 08:39:31.000000000 +0000 +@@ -20,7 +20,7 @@ + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * + ***************************************************************************** +- $XTermId: xterm.log.html,v 1.790 2009/09/11 23:10:00 tom Exp $ ++ $XTermId: xterm.log.html,v 1.793 2009/09/24 08:39:31 tom Exp $ + --> + + +@@ -45,6 +45,7 @@ + is the latest version of this file. + + + ++

Develop

++ ++ +

Patch #248 - 2009/9/11

+