Fix core dump in left-right screen scrolling for long lines.

The nvi maintainer expects this patch to be included in the upcoming
nvi-1.81.6 unless a better fix presents itself.

The MFC reminder below should be taken as a cue to MFC rev 1.1.1.2
of vs_relative.c as well.

PR:		bin/26869
Reported by:	Alex Semenyaka <alexs@snark.ratmir.ru>
Obtained from:	skimo@kotnet.org (via "Alexey V. Neyman" <alex.neyman@auriga.ru>)
MFC after:	1 month
This commit is contained in:
Sheldon Hearn 2002-01-31 13:28:37 +00:00
parent 55228c2a54
commit b4f6fcd394
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/vendor/nvi/dist/; revision=90019
2 changed files with 6 additions and 3 deletions

View File

@ -267,7 +267,10 @@ empty: (void)gp->scr_addstr(sp,
cols_per_screen = sp->cols;
/* Put starting info for this line in the cache. */
if (scno != skip_cols) {
if (offset_in_line >= len) {
smp->c_sboff = offset_in_line;
smp->c_scoff = 255;
} else if (scno != skip_cols) {
smp->c_sboff = offset_in_line;
smp->c_scoff =
offset_in_char = chlen - (scno - skip_cols);

View File

@ -743,7 +743,7 @@ vs_sm_up(sp, rp, count, scmd, smp)
if (!SMAP_CACHE(smp) && vs_line(sp, smp, NULL, NULL))
return (1);
rp->lno = smp->lno;
rp->cno = smp->c_sboff;
rp->cno = smp->c_scoff == 255 ? 0 : smp->c_sboff;
return (0);
}
@ -958,7 +958,7 @@ vs_sm_down(sp, rp, count, scmd, smp)
if (!SMAP_CACHE(smp) && vs_line(sp, smp, NULL, NULL))
return (1);
rp->lno = smp->lno;
rp->cno = smp->c_sboff;
rp->cno = smp->c_scoff == 255 ? 0 : smp->c_sboff;
return (0);
}