diff options
author | Oliver Kiddle <opk@zsh.org> | 2014-12-08 17:23:23 +0100 |
---|---|---|
committer | Oliver Kiddle <opk@zsh.org> | 2014-12-08 17:24:48 +0100 |
commit | 88f4e24d4c42de1072898cd0e26e3d43c7de448c (patch) | |
tree | 326ea242e10e31ece5279ae9049abb19f01a1574 /Src/Zle/zle_vi.c | |
parent | 53e44daeba8481858cded683a780841085f36988 (diff) | |
download | zsh-88f4e24d4c42de1072898cd0e26e3d43c7de448c.tar.gz zsh-88f4e24d4c42de1072898cd0e26e3d43c7de448c.tar.xz zsh-88f4e24d4c42de1072898cd0e26e3d43c7de448c.zip |
33924: allow vi line/characterwise mode to be forced
Diffstat (limited to 'Src/Zle/zle_vi.c')
-rw-r--r-- | Src/Zle/zle_vi.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/Src/Zle/zle_vi.c b/Src/Zle/zle_vi.c index 249e38f15..1a11ca7d5 100644 --- a/Src/Zle/zle_vi.c +++ b/Src/Zle/zle_vi.c @@ -259,15 +259,24 @@ getvirange(int wf) /* Was it a line-oriented move? If so, the command will have set * * the vilinerange flag. In this case, entire lines are taken, * * rather than just the sequence of characters delimited by pos * - * and zlecs. The terminating newline is left out of the range, * + * and zlecs. The terminating newline is left out of the range, * * which the real command must deal with appropriately. At this * * point we just need to make the range encompass entire lines. */ - if(vilinerange) { + vilinerange = (zmod.flags & MOD_LINE) || + (vilinerange && !(zmod.flags & MOD_CHAR)); + if (vilinerange) { int newcs = findbol(); lastcol = zlecs - newcs; zlecs = pos; pos = findeol(); zlecs = newcs; + } else if (!visual) { + /* for a character-wise move don't include a newline at the * + * end of the range */ + int prev = pos; + DECPOS(prev); + if (zleline[prev] == ZWC('\n')) + pos = prev; } return pos; } |