diff options
author | sheldonh <sheldonh@FreeBSD.org> | 2002-01-31 13:28:37 +0000 |
---|---|---|
committer | sheldonh <sheldonh@FreeBSD.org> | 2002-01-31 13:28:37 +0000 |
commit | 6122421847de7afa5fb3c70ddf001fb674e4d9e3 (patch) | |
tree | 72da00fe7d47c53e6b1fc7d9b2464d169a40b7f4 /contrib/nvi | |
parent | fa30b82df1e06e2a03c19d29525f6b924efdeb0e (diff) | |
download | FreeBSD-src-6122421847de7afa5fb3c70ddf001fb674e4d9e3.zip FreeBSD-src-6122421847de7afa5fb3c70ddf001fb674e4d9e3.tar.gz |
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
Diffstat (limited to 'contrib/nvi')
-rw-r--r-- | contrib/nvi/vi/vs_line.c | 5 | ||||
-rw-r--r-- | contrib/nvi/vi/vs_smap.c | 4 |
2 files changed, 6 insertions, 3 deletions
diff --git a/contrib/nvi/vi/vs_line.c b/contrib/nvi/vi/vs_line.c index b439de9..e48d5ef 100644 --- a/contrib/nvi/vi/vs_line.c +++ b/contrib/nvi/vi/vs_line.c @@ -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); diff --git a/contrib/nvi/vi/vs_smap.c b/contrib/nvi/vi/vs_smap.c index af38057..18d7942 100644 --- a/contrib/nvi/vi/vs_smap.c +++ b/contrib/nvi/vi/vs_smap.c @@ -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); } |