Skip to content

Commit

Permalink
Import patch from vendor (taken from nvi-1.81.5) that fixes problematic
Browse files Browse the repository at this point in the history
interaction between the leftright and number options.

PR:		bin/23912
Reported by:	"Stephen D. Spencer" <[email protected]>
Obtained from:	[email protected]
  • Loading branch information
sheldonh authored and sheldonh committed Jan 7, 2002
1 parent a0f3c80 commit fa30b82
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions contrib/nvi/vi/vs_relative.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -122,23 +131,18 @@ 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. */
listset = O_ISSET(sp, O_LIST);
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' && \
Expand Down

0 comments on commit fa30b82

Please sign in to comment.