diff options
Diffstat (limited to 'Src/Zle')
-rw-r--r-- | Src/Zle/zle_vi.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/Src/Zle/zle_vi.c b/Src/Zle/zle_vi.c index a60caa2b4..68b1c9211 100644 --- a/Src/Zle/zle_vi.c +++ b/Src/Zle/zle_vi.c @@ -700,10 +700,14 @@ viindent(UNUSED(char **args)) } oldcs = zlecs; /* add a tab to the beginning of each line within range */ - while (zlecs < c2) { - spaceinline(1); - zleline[zlecs] = '\t'; - zlecs = findeol() + 1; + while (zlecs <= c2 + 1) { + if (zleline[zlecs] == '\n') { /* leave blank lines alone */ + ++zlecs; + } else { + spaceinline(1); + zleline[zlecs] = '\t'; + zlecs = findeol() + 1; + } } /* go back to the first line of the range */ zlecs = oldcs; @@ -830,6 +834,8 @@ viswapcase(UNUSED(char **args)) if (n < 1) return 1; eol = findeol(); + if (zlecs == eol) + return 1; while (zlecs < eol && n--) { if (ZC_ilower(zleline[zlecs])) zleline[zlecs] = ZC_toupper(zleline[zlecs]); |