diff options
author | Jaehwang Jung <tomtomjhj@gmail.com> | 2023-02-28 07:09:12 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-27 22:09:12 +0000 |
commit | b50ee4a8dc4306e4be78ac33fb74b21dc6be5538 (patch) | |
tree | 44fc475a99cd2bdfce6d96be161bbd44fb24703d /src/nvim/diff.c | |
parent | 521034edef342f440f3e4bfc759159acc55d3cef (diff) | |
download | rneovim-b50ee4a8dc4306e4be78ac33fb74b21dc6be5538.tar.gz rneovim-b50ee4a8dc4306e4be78ac33fb74b21dc6be5538.tar.bz2 rneovim-b50ee4a8dc4306e4be78ac33fb74b21dc6be5538.zip |
fix(diff): adjust extmarks after diffput/diffget (#22440)
Problem: on_bytes is not triggered by diffput/diffget if the line count
does not change.
Diffstat (limited to 'src/nvim/diff.c')
-rw-r--r-- | src/nvim/diff.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/nvim/diff.c b/src/nvim/diff.c index c5b28822d0..289939b2ca 100644 --- a/src/nvim/diff.c +++ b/src/nvim/diff.c @@ -31,6 +31,7 @@ #include "nvim/ex_cmds.h" #include "nvim/ex_cmds_defs.h" #include "nvim/ex_docmd.h" +#include "nvim/extmark.h" #include "nvim/extmark_defs.h" #include "nvim/fileio.h" #include "nvim/fold.h" @@ -3102,6 +3103,9 @@ static void diffgetput(const int addr_count, const int idx_cur, const int idx_fr if (buf_empty && (curbuf->b_ml.ml_line_count == 2)) { // Added the first line into an empty buffer, need to // delete the dummy empty line. + // This has a side effect of incrementing curbuf->deleted_bytes, + // which results in inaccurate reporting of the byte count of + // previous contents in buffer-update events. buf_empty = false; ml_delete((linenr_T)2, false); } @@ -3143,6 +3147,7 @@ static void diffgetput(const int addr_count, const int idx_cur, const int idx_fr } } } + extmark_adjust(curbuf, lnum, lnum + count - 1, (long)MAXLNUM, added, kExtmarkUndo); changed_lines(lnum, 0, lnum + count, added, true); if (did_free) { |