diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2019-11-11 21:48:14 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-11 21:48:14 +0100 |
commit | 122426966e1046f45801103eace2887ea59d4941 (patch) | |
tree | e3f113e8e91876e1746d723ac082a27355328404 /src/nvim/mark.c | |
parent | 181486d7e614c1a417ec0f555cdfd25716cb5e38 (diff) | |
parent | 18a8b702c0ce7a8bacd84f6c95e440ae23a3299e (diff) | |
download | rneovim-122426966e1046f45801103eace2887ea59d4941.tar.gz rneovim-122426966e1046f45801103eace2887ea59d4941.tar.bz2 rneovim-122426966e1046f45801103eace2887ea59d4941.zip |
Merge pull request #11356 from bfredl/extmark2
extmark API feature
Diffstat (limited to 'src/nvim/mark.c')
-rw-r--r-- | src/nvim/mark.c | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/src/nvim/mark.c b/src/nvim/mark.c index e8f1651a6e..454e9e46f4 100644 --- a/src/nvim/mark.c +++ b/src/nvim/mark.c @@ -905,9 +905,10 @@ void mark_adjust(linenr_T line1, linenr_T line2, long amount, long amount_after, - bool end_temp) + bool end_temp, + ExtmarkOp op) { - mark_adjust_internal(line1, line2, amount, amount_after, true, end_temp); + mark_adjust_internal(line1, line2, amount, amount_after, true, end_temp, op); } // mark_adjust_nofold() does the same as mark_adjust() but without adjusting @@ -916,14 +917,16 @@ void mark_adjust(linenr_T line1, // calling foldMarkAdjust() with arguments line1, line2, amount, amount_after, // for an example of why this may be necessary, see do_move(). void mark_adjust_nofold(linenr_T line1, linenr_T line2, long amount, - long amount_after, bool end_temp) + long amount_after, bool end_temp, + ExtmarkOp op) { - mark_adjust_internal(line1, line2, amount, amount_after, false, end_temp); + mark_adjust_internal(line1, line2, amount, amount_after, false, end_temp, op); } static void mark_adjust_internal(linenr_T line1, linenr_T line2, long amount, long amount_after, - bool adjust_folds, bool end_temp) + bool adjust_folds, bool end_temp, + ExtmarkOp op) { int i; int fnum = curbuf->b_fnum; @@ -979,6 +982,9 @@ static void mark_adjust_internal(linenr_T line1, linenr_T line2, sign_mark_adjust(line1, line2, amount, amount_after); bufhl_mark_adjust(curbuf, line1, line2, amount, amount_after, end_temp); + if (op != kExtmarkNOOP) { + extmark_adjust(curbuf, line1, line2, amount, amount_after, op, end_temp); + } } /* previous context mark */ @@ -1090,7 +1096,7 @@ static void mark_adjust_internal(linenr_T line1, linenr_T line2, // cursor is inside them. void mark_col_adjust( linenr_T lnum, colnr_T mincol, long lnum_amount, long col_amount, - int spaces_removed) + int spaces_removed, ExtmarkOp op) { int i; int fnum = curbuf->b_fnum; @@ -1110,6 +1116,13 @@ void mark_col_adjust( col_adjust(&(namedfm[i].fmark.mark)); } + // Extmarks + if (op != kExtmarkNOOP) { + // TODO(timeyyy): consider spaces_removed? (behave like a delete) + extmark_col_adjust(curbuf, lnum, mincol, lnum_amount, col_amount, + kExtmarkUndo); + } + /* last Insert position */ col_adjust(&(curbuf->b_last_insert.mark)); |