When select includes some nonvisible lines, in addition to the lines
visible within the textbuffer window, the first or last line can be wrong.
The top or bottom line's contents may be omitted from the result or
fully included in the result even if it was only partially included.
Select operates this way: User moves pointer to beginning of selection
and depresses left mouse button. Then user moves pointer to end of
selection and releases button, at which time xchat makes a copy of the
selected material. To select more than one window's worth of text, user
moves pointer vertically to just below the bottom margin or above the
top margin, and the text in the window scrolls up or down, respectively.
The top or bottom line, now out of view, is mis-selected: though only a
part of it belongs in the selection, the whole line is either completely
excluded or completely included in the selection.
To reproduce the problem:
1. Join a channel with an existing log of varying-width lines, so as
to test the two- and three-subline case as well as the normal case.
Scroll back a few screensful.
2. Start a selection in the middle of some line. Move the pointer down
to and past the bottom margin, and wait as the screen scrolls up until
the beginning of the selection has scrolled out of sight a few lines.
3. Paste the selection somewhere convenient (I use a "vi foo" window).
4. Note that the beginning of the selection is improperly rendered:
Either its line is missing or completely selected, despite that you
only selected the right-hand portion of it. If you selected a line
with no sublines, it is completely missing. If you selected a line with
sublines, it is present or absent depending on what subline you started
the selection on: If you selected the last subline, it is completely
absent. If you selected a non-last subline, it is completely present.
5. Same as step 2 but move the pointer up to and past the top margin,
and wait as the screen scrolls down until the end of the selection
has scrolled out of sight a few lines. Paste the selection somewhere
6. Note that the last line of the selection is completely missing,
whether single- or multiple-subline, no matter where you began selection
among sublines. Note that even if you begin by selecting an entire line
in this case, the line is completely missing from the selection.
Analysis of the problem:
The root of the problem is lines 1232-1233 in xtext.c function
1232 if (line > xtext->adj->page_size || line < 0)
1233 return 0;
This function receives a window line number from gtk_xtext_find_char()
which may be negative or greater than the page_size, and is, in the
The attached patch corrects this bug. This occurs on revision 1475.
Log in to post a comment.