Date: Sat, 19 Jan 2002 05:00:03 -0800 (PST) From: "Alexey V. Neyman" <alex.neyman@auriga.ru> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/26869: vi(1) crashes in viewing a file with long lines Message-ID: <200201191300.g0JD03W29524@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/26869; it has been noted by GNATS. From: "Alexey V. Neyman" <alex.neyman@auriga.ru> To: sheldonh@freebs.org Cc: bug-followup@freebsd.org Subject: Re: bin/26869: vi(1) crashes in viewing a file with long lines Date: Sat, 19 Jan 2002 15:52:54 +0300 Forwarding to Audit-Trail. The patch solves the problem for me either. ---------- Forwarded Message ---------- Subject: Re: :set leftright fix? (FreeBSD PR 26869) Date: Sat, 19 Jan 2002 13:30:15 +0100 From: Sven Verdoolaege <skimo@kotnet.org> To: "Alexey V. Neyman" <alex.neyman@auriga.ru> Cc: bostic@abyssinian.sleepycat.com On Sat, Jan 19, 2002 at 08:08:00AM +0300, Alexey V. Neyman wrote: > I agree that the correct fix would be to prevent sp->cno from being > set to invalid value instead of adjusting it in vs_line(). However, > its more a stopgap fix. Well, the problem really is the rp->cno = smp->c_sboff; line in vs_smap.c If no part of the line is currently visible, c_sboff will point past the end of the line. I thought I could just set cno to 0, because the latest posix draft I have indicates that all the scolling command will move to nonblank, but they don't mention the leftright option and this is were the behaviour differs. Nvi will move to the first position of the current horizontal part of the screen in this case. My current patch is appended below. Not really proud of it either. I special case offset in character 255 to indicate that there is no character on the screen and in that case we go to the first nonblank even with the leftright option set. (The patch should apply against 1.79 with some offsets). > > > Have you tried 1.81.5 ? > > No, I haven't. As far as I know it requires widechar support which is > not in freebsd-stable. You have been misinformed. skimo Index: vs_line.c =================================================================== RCS file: /b/CVSROOT/vi/vi/vs_line.c,v retrieving revision 10.37 diff -u -r10.37 vs_line.c --- vs_line.c 2001/08/30 13:56:07 10.37 +++ vs_line.c 2002/01/19 12:18:57 @@ -273,7 +273,10 @@ 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); Index: vs_smap.c =================================================================== RCS file: /b/CVSROOT/vi/vi/vs_smap.c,v retrieving revision 10.29 diff -u -r10.29 vs_smap.c --- vs_smap.c 2001/06/25 15:19:38 10.29 +++ vs_smap.c 2002/01/19 12:18:57 @@ -727,7 +727,7 @@ 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); } @@ -941,7 +941,7 @@ 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); } ------------------------------------------------------- -- <-------------------------> ) May the Sun and Water ( Regards, Alexey V. Neyman ) always fall upon you! ( mailto:alex.neyman@auriga.ru <-------------------------> To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200201191300.g0JD03W29524>