Fix the TAB not cause scrolling when entered at the end of the last line.

It may cause misterious chars appearse in the middle of the scrolled lines.

The bug trigger: enter
grep P_32 /usr/include/*.h
command and see misterious "db.\" filename.
This commit is contained in:
Andrey A. Chernov 2000-05-29 18:35:13 +00:00
parent d1144d51f8
commit b2f64c0141
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=61072

View File

@ -269,9 +269,14 @@ sc_term_tab(scr_stat *scp, int n)
if (n < 1)
n = 1;
i = (scp->xpos & ~7) + 8*n;
if (i >= scp->xsize)
sc_move_cursor(scp, 0, scp->ypos + 1);
else
if (i >= scp->xsize) {
if (scp->ypos >= scp->ysize - 1) {
scp->xpos = 0;
scp->ypos++;
scp->cursor_pos = scp->ypos*scp->xsize;
} else
sc_move_cursor(scp, 0, scp->ypos + 1);
} else
sc_move_cursor(scp, i, scp->ypos);
}