Introduction
Introduction Statistics Contact Development Disclaimer Help
tvi: reset vi_soset in ^a command - neatvi - [fork] simple vi-type editor with …
git clone git://src.adamsgaard.dk/neatvi
Log
Files
Refs
README
---
commit 19e46a1b49c9d49bb2d4161dd6acf4727c15749d
parent 8fbb8b3a23c593b84d3bc4218329226d6b0cdb59
Author: Ali Gholami Rudi <[email protected]>
Date: Sun, 21 Nov 2021 00:08:11 +0330
vi: reset vi_soset in ^a command
Diffstat:
M vi.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/vi.c b/vi.c
t@@ -258,7 +258,7 @@ static int vi_search(int cmd, int cnt, int *row, int *off)
char *kwd;
int r = *row;
int o = *off;
- int failed = 0;
+ char *failed = NULL;
int len = 0;
int i, dir;
if (cmd == '/' || cmd == '?') {
t@@ -289,7 +289,7 @@ static int vi_search(int cmd, int cnt, int *row, int *off)
o = *off;
for (i = 0; i < cnt; i++) {
if (lbuf_search(xb, kwd, dir, &r, &o, &len)) {
- failed = 1;
+ failed = " not found";
break;
}
if (i + 1 < cnt && cmd == '/')
t@@ -301,14 +301,14 @@ static int vi_search(int cmd, int cnt, int *row, int *of…
if (vi_soset) {
*off = -1;
if (*row + vi_so < 0 || *row + vi_so >= lbuf_len(xb))
- failed = 1;
+ failed = " bad offset";
else
*row += vi_so;
}
}
- if (failed)
- snprintf(vi_msg, sizeof(vi_msg), "\"%s\" not found\n", kwd);
- return failed;
+ if (failed != NULL)
+ snprintf(vi_msg, sizeof(vi_msg), "/%s/%s\n", kwd, failed ? fai…
+ return failed != NULL;
}
/* read a line motion */
t@@ -543,6 +543,7 @@ static int vi_motion(int *row, int *off)
if (!(cs = vi_curword(xb, *row, *off)))
return -1;
ex_kwdset(cs, +1);
+ vi_soset = 0;
free(cs);
if (vi_search('n', cnt, row, off))
return -1;
You are viewing proxied material from mx1.adamsgaard.dk. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.