aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSheldon Hearn <sheldonh@FreeBSD.org>2002-01-07 14:26:12 +0000
committerSheldon Hearn <sheldonh@FreeBSD.org>2002-01-07 14:26:12 +0000
commit55228c2a54c4fd0f650a51fa16b96b2849bf2ac1 (patch)
tree794ab181046fb39ba74678a5e2775a8fb5e34750
parentb8d4dc6c68ea4c4b7942c0b188c18a5aca4f6396 (diff)
downloadsrc-55228c2a54c4fd0f650a51fa16b96b2849bf2ac1.tar.gz
src-55228c2a54c4fd0f650a51fa16b96b2849bf2ac1.zip
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
Notes
Notes: svn path=/vendor/nvi/dist/; revision=89010
-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 c92c10c43e2e..878fc4f944ad 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' && \