From 874d317334fae1ddce316f9b6f4d0ce4e434bf52 Mon Sep 17 00:00:00 2001 From: Thomas Ulmer Date: Tue, 23 Jun 2026 21:34:41 -0700 Subject: heirloom vi fixes from arch AUR --- ex_vmain.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'ex_vmain.c') diff --git a/ex_vmain.c b/ex_vmain.c index 8bdfa3f..f1a2750 100644 --- a/ex_vmain.c +++ b/ex_vmain.c @@ -159,7 +159,7 @@ vmain(void) Xhadcnt = hadcnt = 0; Xcnt = cnt = 1; splitw = 0; - if (i = holdupd) { + if ((i = holdupd)) { if (state == VISUAL) ignore(peekkey()); holdupd = 0; @@ -204,7 +204,7 @@ looptop: * an 'empty' named buffer spec in the routine * kshift (see ex_temp.c). */ - forbid (c == '0' || !xisalpha(c) && !xisdigit(c)); + forbid (c == '0' || (!xisalpha(c) && !xisdigit(c))); vreg = c; } reread: @@ -836,7 +836,7 @@ case_ATTN: vmacchng(1); setLAST(); i = 0; - if (vreg && partreg(vreg) || !vreg && pkill[0]) { + if ((vreg && partreg(vreg)) || (!vreg && pkill[0])) { /* * Restoring multiple lines which were partial * lines; will leave cursor in middle @@ -1123,7 +1123,10 @@ fixup: * in open mode and . moved, then redraw. */ i = vcline + (dot - addr); - if (i < 0 || i >= vcnt && i >= -vcnt || state != VISUAL && dot != addr) { + if (i < 0 + || (vcnt >= 0 && i >= vcnt) + || (vcnt < 0 && i >= -vcnt) + || (state != VISUAL && dot != addr)) { if (state == CRTOPEN) vup1(); if (vcnt > 0) @@ -1275,8 +1278,8 @@ vsave(void) { char *temp = smalloc(LBSIZE); - CP(temp, linebuf); - if (FIXUNDO && vundkind == VCHNG || vundkind == VCAPU) { + lcpy(temp, linebuf, LBSIZE); + if ((FIXUNDO && vundkind == VCHNG) || vundkind == VCAPU) { /* * If the undo state is saved in the temporary buffer * vutmp, then we sync this into the temp file so that @@ -1286,7 +1289,7 @@ vsave(void) * with line dot (e.g. in case ':') above, so beware. */ prepapp(); - CP(linebuf, vutmp); + lcpy(linebuf, vutmp, LBSIZE); putmark(dot); vremote(1, yank, 0); vundkind = VMCHNG; @@ -1416,7 +1419,7 @@ str2cell(cell *dst, register char *src) } while (src[-n]); } else #endif /* MB */ - while (*cp++ = *src++ & 0377); + while ((*cp++ = *src++ & 0377)); return dst; } @@ -1425,7 +1428,7 @@ cell2str(char *dst, register cell *src) { register char *cp = dst; - while (*cp++ = *src++); + while ((*cp++ = *src++)); return dst; } @@ -1434,7 +1437,7 @@ cellcpy(cell *dst, register cell *src) { register cell *cp = dst; - while (*cp++ = *src++); + while ((*cp++ = *src++)); return dst; } -- cgit v1.2.3