diff options
author | Matthieu Coudron <mattator@gmail.com> | 2020-04-24 18:33:19 +0200 |
---|---|---|
committer | Matthieu Coudron <mattator@gmail.com> | 2020-04-24 20:32:20 +0200 |
commit | 7d2879694e67d4392a46377aafdf6445c44f18bc (patch) | |
tree | 7ef42e2b1781420bce36f6e6cbef37c99ca8c64d | |
parent | d20142a31f40140ae789e20d86094ecccb84d6fb (diff) | |
download | rneovim-7d2879694e67d4392a46377aafdf6445c44f18bc.tar.gz rneovim-7d2879694e67d4392a46377aafdf6445c44f18bc.tar.bz2 rneovim-7d2879694e67d4392a46377aafdf6445c44f18bc.zip |
extmark: introduce extmark_splice_cols
to ease up notations.
-rw-r--r-- | src/nvim/extmark.c | 9 | ||||
-rw-r--r-- | src/nvim/fold.c | 11 |
2 files changed, 14 insertions, 6 deletions
diff --git a/src/nvim/extmark.c b/src/nvim/extmark.c index 38d111f2aa..1457a1172d 100644 --- a/src/nvim/extmark.c +++ b/src/nvim/extmark.c @@ -578,6 +578,15 @@ void extmark_splice(buf_T *buf, } } +void extmark_splice_cols(buf_T *buf, + int start_row, colnr_T start_col, + colnr_T old_col, colnr_T new_col, + ExtmarkOp undo) +{ + extmark_splice(buf, start_row, start_col, + 0, old_col, + 0, new_col, undo); +} void extmark_move_region(buf_T *buf, int start_row, colnr_T start_col, diff --git a/src/nvim/fold.c b/src/nvim/fold.c index 08f43dff9a..f18a1b62a4 100644 --- a/src/nvim/fold.c +++ b/src/nvim/fold.c @@ -1648,9 +1648,8 @@ static void foldAddMarker( } ml_replace_buf(buf, lnum, newline, false); if (added) { - extmark_splice(buf, (int)lnum-1, (int)line_len, - 0, 0, - 0, (int)added, kExtmarkUndo); + extmark_splice_cols(buf, (int)lnum-1, (int)line_len, + 0, (int)added, kExtmarkUndo); } } } @@ -1720,9 +1719,9 @@ static void foldDelMarker(buf_T *buf, linenr_T lnum, char_u *marker, size_t mark memcpy(newline, line, (size_t)(p - line)); STRCPY(newline + (p - line), p + len); ml_replace_buf(buf, lnum, newline, false); - extmark_splice(buf, (int)lnum-1, (int)(p - line), - 0, (int)len, - 0, 0, kExtmarkUndo); + extmark_splice_cols(buf, (int)lnum-1, (int)(p - line), + (int)len, + 0, kExtmarkUndo); } break; } |