diff options
| author | aymeric <aymeric@NetBSD.org> | 2001-12-13 20:51:36 +0000 |
|---|---|---|
| committer | aymeric <aymeric@NetBSD.org> | 2001-12-13 20:51:36 +0000 |
| commit | b9d2b65ffd7cff495e1ca56aad144a970889f6b2 (patch) | |
| tree | 4352c95c3122a18a6a06474ce1dcdaeecceca08c /usr.bin | |
| parent | ca9f8b13da05c77cc36411334c33754069f3e5c9 (diff) | |
Finally apply a fix from nvi 1.81.x to replace a fix committed by
Simon Burge which came from the Debian project.
This is still not TRT, but it's correct, and it gets us closer to future
versions of nvi.
I'll do ART (A Right Thing) when I have time... That's why I'm committing
this now. :-/
This fixes FreeBSD PR#23912
Diffstat (limited to 'usr.bin')
| -rw-r--r-- | usr.bin/vi/vi/vs_relative.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/usr.bin/vi/vi/vs_relative.c b/usr.bin/vi/vi/vs_relative.c index b2cea469dee..d09c30a3285 100644 --- a/usr.bin/vi/vi/vs_relative.c +++ b/usr.bin/vi/vi/vs_relative.c @@ -1,4 +1,4 @@ -/* $NetBSD: vs_relative.c,v 1.2 1998/01/09 08:08:53 perry Exp $ */ +/* $NetBSD: vs_relative.c,v 1.3 2001/12/13 20:51:36 aymeric Exp $ */ /*- * Copyright (c) 1993, 1994 @@ -113,6 +113,15 @@ vs_columns(sp, lp, lno, cnop, diffp) int ch, leftright, listset; char *p; + /* + * Initialize the screen offset. + */ + scno = 0; + + /* Leading number if O_NUMBER option set. */ + if (O_ISSET(sp, O_NUMBER)) + scno += O_NUMBER_LENGTH; + /* Need the line to go any further. */ if (lp == NULL) { (void)db_get(sp, lno, 0, &lp, &len); @@ -124,7 +133,7 @@ vs_columns(sp, lp, lno, cnop, diffp) if (lp == NULL) { done: if (diffp != NULL) /* XXX */ *diffp = 0; - return (0); + return scno; } /* Store away the values of the list and leftright edit options. */ @@ -132,15 +141,10 @@ done: if (diffp != NULL) /* XXX */ leftright = O_ISSET(sp, O_LEFTRIGHT); /* - * Initialize the pointer into the buffer and screen and current - * offsets. + * Initialize the pointer into the buffer and current offset. */ p = lp; - curoff = scno = 0; - - /* Leading number if O_NUMBER option set. */ - if (O_ISSET(sp, O_NUMBER)) - scno += O_NUMBER_LENGTH; + curoff = 0; /* Macro to return the display length of any signal character. */ #define CHLEN(val) (ch = *(u_char *)p++) == '\t' && \ |
