summaryrefslogtreecommitdiffstats
path: root/contrib/nvi
diff options
context:
space:
mode:
authorsheldonh <sheldonh@FreeBSD.org>2002-01-07 14:26:12 +0000
committersheldonh <sheldonh@FreeBSD.org>2002-01-07 14:26:12 +0000
commitfa30b82df1e06e2a03c19d29525f6b924efdeb0e (patch)
tree794ab181046fb39ba74678a5e2775a8fb5e34750 /contrib/nvi
parenta0f3c80b90dd2addddb37aa3047d008fc519b99a (diff)
downloadFreeBSD-src-fa30b82df1e06e2a03c19d29525f6b924efdeb0e.zip
FreeBSD-src-fa30b82df1e06e2a03c19d29525f6b924efdeb0e.tar.gz
Import patch from vendor (taken from nvi-1.81.5) that fixes problematic
interaction between the leftright and number options. PR: bin/23912 Reported by: "Stephen D. Spencer" <gladiatr@boneyard.lawrence.ks.us> Obtained from: skimo@kotnet.org
Diffstat (limited to 'contrib/nvi')
-rw-r--r--contrib/nvi/vi/vs_relative.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/contrib/nvi/vi/vs_relative.c b/contrib/nvi/vi/vs_relative.c
index c92c10c..878fc4f 100644
--- a/contrib/nvi/vi/vs_relative.c
+++ b/contrib/nvi/vi/vs_relative.c
@@ -111,6 +111,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);
@@ -122,7 +131,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. */
@@ -130,15 +139,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' && \
OpenPOWER on IntegriCloud