Hi!
I must say, I'm a bit shy about this, so don't rip my head off, I'm
obviously not trying to question Theo's commit. I just came across this
anomaly:
cvs diff -r 1.26 -r 1.27 vi.c
@@ -792,8 +792,9 @@ vi_cmd(int argcnt, const char *cmd)
return -1;
if (*cmd == 'c' &&
(cmd[1]=='w' || cmd[1]=='W') &&
- !isspace(es->cbuf[es->cursor])) {
- while (isspace(es->cbuf[--ncursor]))
+ !isspace((unsigned
char)es->cbuf[es->cursor])) {
+ while ((unsigned char)
+ isspace(es->cbuf[--ncursor]))
;
ncursor++;
}
That last cast, before isspace(es->...), at line 796; Isn't that cast supposed
to be inside the isspace() function, right before es->..., just like in the
line above it?
So like:
--- vi.c.orig 2013-12-18 17:33:03.667236200 +0100
+++ vi.c 2013-12-18 17:33:21.810235659 +0100
@@ -793,8 +793,7 @@ vi_cmd(int argcnt, const char *cmd)
if (*cmd == 'c' &&
(cmd[1]=='w' || cmd[1]=='W') &&
!isspace((unsigned
char)es->cbuf[es->cursor])) {
- while ((unsigned char)
- isspace(es->cbuf[--ncursor]))
+ while (isspace((unsigned
char)es->cbuf[--ncursor]))
;
ncursor++;
}
I admit, the bug I was hunting was not present somehow on OpenBSD, just on
Linux, where I am using this ksh with some modifications and some diffs to make
it compile and work on Linux.
Nevertheless this fixed it for me.
Oh, and the bug was when I entered command mode in vi edit mode, then if
I had something like this in my edit buffer:
$ cd /foo/bar
... then escape to command mode, move to the very beginning of the line,
then press 'c' -> 'w' to delete "one word". Then the previous behaviour
was to delete until before the space, and now after these changes it
would delete the space also.
Daniel
--
LÉVAI Dániel
PGP key ID = 0x83B63A8F
Key fingerprint = DBEC C66B A47A DFA2 792D 650C C69B BE4C 83B6 3A8F