diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2020-01-16 15:31:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-16 15:31:05 +0100 |
commit | 6e78b2162382718b638c4532a155e5c3f9ed7515 (patch) | |
tree | 5868096a30a61deed1765e1c9ec93072a4d0c34b /src/nvim/edit.c | |
parent | 8ba3354d74a8f90ded0997100bdbe845a8c5382f (diff) | |
parent | ca1a00edd6d6345b848a28d077d6a192528f811e (diff) | |
download | rneovim-6e78b2162382718b638c4532a155e5c3f9ed7515.tar.gz rneovim-6e78b2162382718b638c4532a155e5c3f9ed7515.tar.bz2 rneovim-6e78b2162382718b638c4532a155e5c3f9ed7515.zip |
Merge pull request #11563 from bfredl/mark_madness
extmarks: mark sanity/madness
Diffstat (limited to 'src/nvim/edit.c')
-rw-r--r-- | src/nvim/edit.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c index d59924cd08..cdb4b127da 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -1826,11 +1826,14 @@ change_indent ( /* We only put back the new line up to the cursor */ new_line[curwin->w_cursor.col] = NUL; + int new_col = curwin->w_cursor.col; // Put back original line ml_replace(curwin->w_cursor.lnum, orig_line, false); curwin->w_cursor.col = orig_col; + curbuf_splice_pending++; + /* Backspace from cursor to start of line */ backspace_until_column(0); @@ -1838,13 +1841,16 @@ change_indent ( ins_bytes(new_line); xfree(new_line); - } - // change_indent seems to bec called twice, this combination only triggers - // once for both calls - if (new_cursor_col - vcol != 0) { - extmark_col_adjust(curbuf, curwin->w_cursor.lnum, 0, 0, amount, - kExtmarkUndo); + curbuf_splice_pending--; + + // TODO(bfredl): test for crazy edge cases, like we stand on a TAB or + // something? does this even do the right text change then? + int delta = orig_col - new_col; + extmark_splice(curbuf, curwin->w_cursor.lnum-1, new_col, + 0, delta < 0 ? -delta : 0, + 0, delta > 0 ? delta : 0, + kExtmarkUndo); } } |