diff options
author | bfredl <bjorn.linse@gmail.com> | 2024-02-01 18:52:12 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-01 18:52:12 +0100 |
commit | 05fd70f19b39519985000141d022971e37d66189 (patch) | |
tree | f067014a7ba6cd6bf781ed9f65ce74e2539b01d9 /src/nvim/undo.c | |
parent | 4c91194611086916c833d61e28e2f5e689316e83 (diff) | |
parent | b50fdcba4a1dadda5db7cfb527471b9956768ac2 (diff) | |
download | rneovim-05fd70f19b39519985000141d022971e37d66189.tar.gz rneovim-05fd70f19b39519985000141d022971e37d66189.tar.bz2 rneovim-05fd70f19b39519985000141d022971e37d66189.zip |
Merge pull request #27122 from luukvbaal/signcol
fix(column): clear "b_signcols" before moving saved marks
Diffstat (limited to 'src/nvim/undo.c')
-rw-r--r-- | src/nvim/undo.c | 33 |
1 files changed, 3 insertions, 30 deletions
diff --git a/src/nvim/undo.c b/src/nvim/undo.c index 3eb0f1f2ec..547ac605e7 100644 --- a/src/nvim/undo.c +++ b/src/nvim/undo.c @@ -2427,39 +2427,15 @@ static void u_undoredo(bool undo, bool do_buf_event) curbuf->b_op_end.lnum = curbuf->b_ml.ml_line_count; } - int row1 = MAXLNUM; - int row2 = -1; - int row3 = -1; - // Tricky: ExtmarkSavePos may come after ExtmarkSplice which does call - // buf_signcols_count_range() but then misses the yet unrestored marks. - if (curbuf->b_signcols.autom && buf_meta_total(curbuf, kMTMetaSignText)) { - for (int i = 0; i < (int)kv_size(curhead->uh_extmark); i++) { - ExtmarkUndoObject undo_info = kv_A(curhead->uh_extmark, i); - if (undo_info.type == kExtmarkSplice) { - ExtmarkSplice s = undo_info.data.splice; - if (s.old_row > 0 || s.new_row > 0) { - row1 = MIN(row1, s.start_row); - row2 = MAX(row2, s.start_row + (undo ? s.new_row : s.old_row) + 1); - row3 = MAX(row3, s.start_row + (undo ? s.old_row : s.new_row) + 1); - } - } - } - if (row2 != -1) { - // Remove signs inside edited region from "b_signcols.count". - buf_signcols_count_range(curbuf, row1, row2, 0, kTrue); - } - } // Adjust Extmarks if (undo) { for (int i = (int)kv_size(curhead->uh_extmark) - 1; i > -1; i--) { - ExtmarkUndoObject undo_info = kv_A(curhead->uh_extmark, i); - extmark_apply_undo(undo_info, undo); + extmark_apply_undo(kv_A(curhead->uh_extmark, i), undo); } // redo } else { for (int i = 0; i < (int)kv_size(curhead->uh_extmark); i++) { - ExtmarkUndoObject undo_info = kv_A(curhead->uh_extmark, i); - extmark_apply_undo(undo_info, undo); + extmark_apply_undo(kv_A(curhead->uh_extmark, i), undo); } } if (curhead->uh_flags & UH_RELOAD) { @@ -2467,10 +2443,7 @@ static void u_undoredo(bool undo, bool do_buf_event) // should have all info to send a buffer-reloaing on_lines/on_bytes event buf_updates_unload(curbuf, true); } - // Finish adjusting extmarks: add signs inside edited region to "b_signcols.count". - if (row2 != -1) { - buf_signcols_count_range(curbuf, row1, row3, 0, kNone); - } + // Finish adjusting extmarks curhead->uh_entry = newlist; curhead->uh_flags = new_flags; |