summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartynas Venckus <martynas@cvs.openbsd.org>2009-06-29 22:50:20 +0000
committerMartynas Venckus <martynas@cvs.openbsd.org>2009-06-29 22:50:20 +0000
commitcaedec124e78bee32a0006ed58607baad0366fdb (patch)
treed0d666b945431cb92040536e52baec9ab3d8080f
parent5b1a0601e6f53f31340c43392d7d686bc4a865dc (diff)
make VSEARCH werase act like regular werase after the last change.
vi back-words and emacs kill-region are not completely the same. ok merdely@, millert@. "Get it in" Darrin Chandler
-rw-r--r--bin/ksh/vi.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/bin/ksh/vi.c b/bin/ksh/vi.c
index 6acf6ea96c3..889b35a8e6f 100644
--- a/bin/ksh/vi.c
+++ b/bin/ksh/vi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vi.c,v 1.25 2009/06/10 15:08:46 merdely Exp $ */
+/* $OpenBSD: vi.c,v 1.26 2009/06/29 22:50:19 martynas Exp $ */
/*
* vi command editing
@@ -413,13 +413,18 @@ vi_hook(int ch)
refresh(0);
return 0;
} else if (ch == edchars.werase) {
+ struct edstate new_es, *save_es;
int i;
int n = srchlen;
- while (n > 0 && !is_wordch(locpat[n - 1]))
- n--;
- while (n > 0 && is_wordch(locpat[n - 1]))
- n--;
+ new_es.cursor = n;
+ new_es.cbuf = locpat;
+
+ save_es = es;
+ es = &new_es;
+ n = backword(1);
+ es = save_es;
+
for (i = srchlen; --i >= n; )
es->linelen -= char_len((unsigned char)locpat[i]);
srchlen = n;