- fix various bugs when display is scrolled up (#524503)

This commit is contained in:
Miroslav Lichvar 2009-09-29 09:36:52 +00:00
parent 57c13e7864
commit 17ef1051f3
2 changed files with 271 additions and 1 deletions

265
xterm-248-scrollup.patch Normal file
View File

@ -0,0 +1,265 @@
# ftp://invisible-island.net/xterm/patches/temp/xterm-248c.patch.gz
# patch by Thomas E. Dickey <dickey@invisible-island.net>
# 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 $
-->
<HTML>
<HEAD>
@@ -45,6 +45,7 @@
is the latest version of this file.
<UL>
+<LI><A HREF="#xterm_dev">Develop</A>
<LI><A HREF="#xterm_248">Patch #248 - 2009/9/11</A>
<LI><A HREF="#xterm_247">Patch #247 - 2009/8/30</A>
<LI><A HREF="#xterm_246">Patch #246 - 2009/8/16</A>
@@ -296,6 +297,30 @@
<LI><A HREF="#xterm_01">Patch #1 - 1996/1/6</A>
</UL>
+<H1><A NAME="xterm_dev">Develop</A></H1>
+<ul>
+ <li>fix an (old) flaw in the delete-line operation where the text which
+ is scrolled into view while the display is scrolled up was not
+ repainted.
+
+ <li>improve delete-line and insert-line operations, retaining selection
+ when the selection does not intersect the deleted/inserted lines.
+
+ <li>fix an (old) off-by-one error when an application cleared above the
+ cursor position while the display was scrolled up, that would leave
+ an extra line of text uncleared.
+
+ <li>fix a similar problem where the double-size attribute would not be
+ reset when clearing the screen while the display was scrolled up.
+
+ <li>fix an indexing error which would occur if an application cleared
+ a line while the display was scrolled up and was also in UTF-8 mode
+ (Redhat #524503).
+ The error was from <a href="#xterm_228">patch #228</a>
+ but more visible after
+ changes from <a href="#xterm_244">patch #244</a>.
+</ul>
+
<H1><A NAME="xterm_248">Patch #248 - 2009/9/11</A></H1>
<ul>
<li>fix an overlooked adjustment for selecting double-width characters

View File

@ -1,7 +1,7 @@
Summary: Terminal emulator for the X Window System
Name: xterm
Version: 248
Release: 1%{?dist}
Release: 2%{?dist}
URL: http://dickey.his.com/xterm
License: MIT
Group: User Interface/X
@ -16,6 +16,7 @@ Source2: %{name}.desktop
Patch1: xterm-245-resources.patch
Patch2: xterm-222-can-2003-0063.patch
Patch3: xterm-226-man-page_paths.patch
Patch4: xterm-248-scrollup.patch
%bcond_with trace
@ -32,6 +33,7 @@ programs that can't use the window system directly.
%patch1 -p1 -b .resources
%patch2 -p1 -b .can-2003-0063
%patch3 -p1 -b .man-page_paths
%patch4 -p1 -b .scrollup
%build
%configure \
@ -80,6 +82,9 @@ rm -rf $RPM_BUILD_ROOT
%{x11_app_defaults_dir}/XTerm-color
%changelog
* Tue Sep 29 2009 Miroslav Lichvar <mlichvar@redhat.com> 248-2
- fix various bugs when display is scrolled up (#524503)
* Thu Sep 17 2009 Miroslav Lichvar <mlichvar@redhat.com> 248-1
- update to 248