neovim/runtime
Folke Lemaitre 5282d3299c
fix(lsp): restore marks after apply_text_edits() #14630
PROBLEM:
Whenever any text edits are applied to the buffer, the `marks` part of those
lines will be lost. This is mostly problematic for code formatters that format
the whole buffer like `prettier`, `luafmt`, ...

When doing atomic changes inside a vim doc, vim keeps track of those changes and
can update the positions of marks accordingly, but in this case we have a whole
doc that changed. There's no simple way to update the positions of all marks
from the previous document state to the new document state.

SOLUTION:
* save marks right before `nvim_buf_set_lines` is called inside `apply_text_edits`
* check if any marks were lost after doing `nvim_buf_set_lines`
* restore those marks to the previous positions

TEST CASE:
* have a formatter enabled
* open any file
* create a couple of marks
* indent the whole file to the right
* save the file
Before this change: all marks will be removed.
After this change: they will be preserved.

Fixes #14307
2023-06-04 16:45:01 -07:00
..
autoload vim-patch:b7398fe41c9e (#23627) 2023-05-15 09:38:32 +02:00
colors vim-patch:71badf9547e8 (#23285) 2023-04-23 15:22:55 +02:00
compiler vim-patch:86b4816766d9 (#21314) 2022-12-08 16:33:38 +01:00
doc fix(lsp): restore marks after apply_text_edits() #14630 2023-06-04 16:45:01 -07:00
ftplugin vim-patch:b7398fe41c9e (#23627) 2023-05-15 09:38:32 +02:00
indent vim-patch:9.0.1580: CI: indent test hangs on FreeBSD (#23768) 2023-05-26 22:13:42 +08:00
keymap vim-patch:6c391a74fe90 (#15654) 2021-09-13 16:33:41 +02:00
lua fix(lsp): restore marks after apply_text_edits() #14630 2023-06-04 16:45:01 -07:00
macros vim-patch:4072ba571bab 2021-05-01 22:29:03 -04:00
pack/dist/opt refactor(options): deprecate nvim[_buf|_win]_[gs]et_option 2023-05-21 15:14:01 +06:00
plugin vim-patch:b7398fe41c9e (#23627) 2023-05-15 09:38:32 +02:00
queries fix(treesitter): update highlights for query (#23699) 2023-05-21 19:22:28 +02:00
spell feat(runtime): import cleanadd.vim from Vim (#17699) 2022-03-13 04:52:45 +00:00
syntax vim-patch:b7398fe41c9e (#23627) 2023-05-15 09:38:32 +02:00
tools vim-patch:e80086446cc2 (#19848) 2022-08-20 10:04:55 +02:00
tutor docs(tutor): fix TODO line demo (#21965) 2023-01-25 09:46:00 +08:00
CMakeLists.txt refactor(build): move the last generator from scripts/ to src/nvim/generators 2023-04-21 16:46:35 +02:00
delmenu.vim vim-patch:9.0.0141: "delmenu" does not remove autocmmands (#19646) 2022-08-05 12:23:41 +02:00
filetype.lua feat(runtime)!: remove filetype.vim (#20428) 2022-10-17 08:52:40 +02:00
ftoff.vim
ftplugin.vim fix(ftplugin): source Lua files after Vimscript files per directory (#23801) 2023-05-28 15:13:44 +02:00
ftplugof.vim
indent.vim feat(runtime): Allow lua to be used in indent 2021-06-11 01:01:02 +06:00
indoff.vim
macmap.vim
makemenu.vim vim-patch:95a9dd1efc5a 2021-04-27 09:21:32 -04:00
menu.vim vim-patch:b7398fe41c9e (#23627) 2023-05-15 09:38:32 +02:00
mswin.vim feat(ex_cmds)!: remove :behave 2023-04-13 12:15:30 +02:00
neovim.ico feat(windows): show icon in terminal titlebar, taskbar #20607 2022-10-13 05:48:12 -07:00
nvim.appdata.xml NVIM v0.9.0 2023-04-07 13:26:29 +02:00
nvim.desktop build(nvim.desktop): central Kurdish translation #17065 2022-05-13 11:58:22 -07:00
nvim.png Dist: make icon a proper square (#9716) 2019-03-11 21:00:12 +01:00
optwin.vim vim-patch:9.0.0640: cannot scroll by screen line if a line wraps 2023-05-02 13:11:26 +02:00
synmenu.vim vim-patch:3c053a1a5ad2 (#20679) 2022-10-17 08:19:48 +02:00