* view.c (view_move_up): In text wrap mode, don't display parts

of lines that only consist of the (invisible) newline character.
	* view.c (view_move_down): Likewise.
This commit is contained in:
Roland Illig 2005-06-07 07:37:00 +00:00
parent 69879eab1e
commit b2b0d33105
2 changed files with 23 additions and 5 deletions

View File

@ -3,6 +3,9 @@
* view.c (view_ccache_lookup): Replaced the min_nroff_column
variable with a state chart, which makes the code clearer and
fixes a bug in translating line/column pairs into offsets.
* view.c (view_move_up): In text wrap mode, don't display parts
of lines that only consist of the (invisible) newline character.
* view.c (view_move_down): Likewise.
2005-05-31 David Martin <dmartina@excite.com>

View File

@ -1120,6 +1120,13 @@ view_move_up (WView *view, offset_type lines)
} else if (line >= 1) {
view_coord_to_offset (view, &linestart, line, 0);
view_offset_to_coord (view, &line, &col, linestart - 1);
/* if the only thing that would be displayed were a
* single newline character, advance to the previous
* part of the line. */
if (col > 0 && col % width == 0)
col -= width;
else
col -= col % width;
} else {
/* nothing to do */
@ -1157,12 +1164,20 @@ view_move_down (WView *view, offset_type lines)
if (view->text_wrap_mode) {
for (i = 0; i < lines; i++) {
offset_type new_offset, chk_line, chk_col;
view_offset_to_coord (view, &line, &col, view->dpy_topleft);
col += view_get_datacolumns (view);
/* if col is too big here, view_coord_to_offset()
* automatically sets dpy_topleft to the beginning
* of the next line. */
view_coord_to_offset (view, &(view->dpy_topleft), line, col);
view_coord_to_offset (view, &new_offset, line, col);
/* skip to the next line if the only thing that would be
* displayed is the newline character. */
view_offset_to_coord (view, &chk_line, &chk_col, new_offset);
if (chk_line == line && chk_col == col
&& get_byte (view, new_offset) == '\n')
new_offset++;
view->dpy_topleft = new_offset;
}
} else {
view_offset_to_coord (view, &line, &col, view->dpy_topleft);