Commit Graph

68 Commits

Author SHA1 Message Date
Ilia Choly
f5a09f1b03
fix: invoke changed_bytes when rewriting <Tab> char #25125
When tabstop and shiftwidth are not equal, tabs are inserted as individual
spaces and then rewritten as tab characters in a second pass. That second pass
did not call changed_bytes which resulted in events being omitted.

Fixes #25092
2023-09-15 03:45:51 -07:00
zeertzjq
eceb2dffce
fix(spell): splice extmarks on :spellrepall (#23929) 2023-06-06 10:32:30 +08:00
Famiu Haque
576dddb461 test: don't unnecessarily specify win/buf for nvim_(get|set)_option_value
`nvim_(get|set)_option_value` pick the current buffer / window by default for buffer-local/window-local (but not global-local) options. So specifying `buf = 0` or `win = 0` in opts is unnecessary for those options. This PR removes those to reduce code clutter.
2023-05-22 13:02:07 +06:00
Lewis Russell
1fe1bb084d refactor(options): deprecate nvim[_buf|_win]_[gs]et_option
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Co-authored-by: famiu <famiuhaque@protonmail.com>
2023-05-21 15:14:01 +06:00
dundargoc
743860de40
test: replace lfs with luv and vim.fs
test: replace lfs with luv

luv already pretty much does everything lfs does, so this duplication
of dependencies isn't needed.
2023-04-04 21:59:06 +02:00
Jaehwang Jung
2748202e0e fix(diff): trigger on_bytes only once after diffget/diffput
Problem: The fix from b50ee4a8dc may
adjust extmark twice, triggering on_bytes callback twice.

Solution: Don't let mark_adjust adjust extmark.
2023-03-11 18:22:00 +09:00
zeertzjq
89a525de9f
fix(buffer_updates): save and restore current window cursor (#16732)
When a buffer update callback is called, textlock is active so buffer
text cannot be changed, but cursor can still be moved. This can cause
problems when the buffer update is in the middle of an operator, like
the one mentioned in #16729. The solution is to save cursor position and
restore it afterwards, like how cursor is saved and restored when
evaluating an <expr> mapping.
2023-03-09 10:19:00 +08:00
dundargoc
df646572c5
docs: fix typos (#20394)
Co-authored-by: Raphael <glephunter@gmail.com>
Co-authored-by: smjonas <jonas.strittmatter@gmx.de>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2022-09-30 09:53:52 +02:00
zeertzjq
ac66f5af06
fix!: make :undo! notify buffer update callbacks (#20344)
When :undo! was introduced to Nvim the implementation of 'inccommand'
preview callback hasn't been fully decided yet, so not notifying buffer
update callbacks made sense for 'inccommand' preview callback in case it
needs to undo the changes itself.
Now it turns out that the undo-and-forget is done automatically for
'inccommand', so it doesn't make sense for :undo! to avoid notifying
buffer update callbacks anymore.
2022-09-26 07:15:07 +08:00
zeertzjq
c665773897
Merge pull request #18931 from zeertzjq/regexp-num-escaped
fix(substitute): subtract number of backslashes later
2022-06-13 07:18:38 +08:00
zeertzjq
429c40cce3
fix(buffer): disable buffer-updates before removing from window #18933
There can be other places that access window buffer info (e.g.
`tabpagebuflist()`), so checking `w_closing` in `win_findbuf()` doesn't
solve the crash in all cases, and may also cause Nvim's behavior to
diverge from Vim.

Fix #14998
2022-06-12 15:02:00 -07:00
zeertzjq
41bb81a2df fix(substitute): subtract number of backslashes later 2022-06-12 20:42:30 +08:00
Tony Chen
ea71c26ec9 fix(extmarks): splice extmarks on accepting spell 2022-04-02 12:35:33 -04:00
Björn Linse
ef687d3218 fix(buffer_updates): handle :sort of already sorted buffer 2021-10-08 16:15:35 +02:00
Björn Linse
54b2c6800e fix(buffer_updates): cleanup test behavior 2021-10-07 20:22:10 +02:00
Anton Adamansky
7d171b1c48 fix(buffer_updates): make lockmarks not affect extmarks and buffer updates. fixes #12861
Now mark_adjust() will trigger appropriate buf_updates_send_splice() called by extmark_adjust()
2021-10-07 20:21:23 +02:00
Björn Linse
8335e26b2d fix(buffer_updates): handle :delete of the very last line in buffer 2021-10-07 19:35:49 +02:00
Tony Chen
e06936125a
fix(extmarks): splice extmarks on nv_Undo #15920 2021-10-06 09:35:44 -07:00
Thomas Vigouroux
14231463a4
fix(bufupdates): send correct updates for visual paste
One step further towards stable tree-sitter.

Co-authored-by: Björn Linse <bjorn.linse@gmail.com>
2021-08-25 15:11:39 +02:00
chentau
1c962401a1 Manually zero out deleted_bytes2 when substituting and joining lines 2021-06-29 00:48:24 -07:00
jbyuki
a15c2cbab6 add tests in buffer_updates 2021-06-09 12:20:13 -07:00
Thomas Vigouroux
237175cf20
fix(bufupdate): send events when inserting with virtualedit
Problem first raised
https://github.com/nvim-treesitter/nvim-treesitter/issues/1304
2021-05-18 19:31:56 +02:00
chentau
13a9bd006f make get_region_bytecount end-exclusive 2021-05-09 16:23:01 -07:00
chentau
a847abc21b refactor nvim_buf_set_lines to use extmark_splice 2021-05-09 16:22:20 -07:00
chentau
37c8067226 splice extmarks on every line for block visual paste 2021-05-06 20:40:26 -07:00
Björn Linse
63b64ebab0
Merge pull request #14385 from chentau/extmark_delete
Extmarks: remove `curbuf->deleted_bytes2` from `op_delete`
2021-04-17 09:25:44 +02:00
chentau
e32eaf6538 extmarks: remove curbuf->deleted_bytes2 from op_delete 2021-04-16 23:42:53 -07:00
chentau
5a36d413fb flush curbuf->deleted_bytes2 after calling do_move 2021-04-14 21:47:21 -07:00
Björn Linse
c9817603cf
Merge pull request #14318 from chentau/extmark_luado
extmark: splice extmarks on :luado
2021-04-13 15:00:42 +02:00
chentau
ff43d9597e extmark: splice extmarks on :luado 2021-04-12 11:33:50 -07:00
Björn Linse
6435b46b48
Merge pull request #14317 from chentau/extmark_sub
extmark: correct extmark_splice call with substitute and inccommand when replacing with escaped backslashes
2021-04-10 18:14:42 +02:00
chentau
343ee2d254 extmark: correct extmark_splice call with inccommand 2021-04-09 00:34:02 -07:00
chentau
7602c56050 extmark: fixes for noexpandtab and retab 2021-04-02 16:21:46 -07:00
Björn Linse
1186f7dd96
Merge pull request #14191 from chentau/extmark_blockpaste
Extmarks: send correct buffer events on blockwise paste for nonuniform lines
2021-03-24 00:27:55 +01:00
chentau
7fbabbaa57 Extmarks: correct buffer events on blockwise paste 2021-03-23 14:06:57 -07:00
chentau
a92a8ef506 Correctly splice extmarks on tab with noexpandtab set 2021-03-22 20:26:25 -07:00
Björn Linse
6995fad260
Merge pull request #13973 from chentau/on_bytes_undofile
New versions of neovim will not read undofiles written by nvim before this merge (there will be an error message about incopmatible version). Nvim 0.4 (or an master up to bda12927be ) can be used to recover older undofiles, so if you worried about unsaved changes lurking around in undofiles it would make sense to keep such version around somewhere to recover them.

This is a necessary change to keep tree-sitter and plugins dependent on byte-level buffer change events fully working with undo states from a undofile. If there is a clear demand we might implement reading of the old format. Such recovered buffers will not be be fully functional with plugins relying on buffer updates or tree-sitter, however.
2021-03-03 09:45:06 +01:00
chentau
f42e932df4 Extmarks: Save extmark undo information to undofile. 2021-03-02 12:45:54 -08:00
Björn Linse
772421f6b1
Merge pull request #13692 from mjlbach/fix_cursor_respect_current_line
fix_cursor: do not change line number when edit will not impact cursor row
2021-02-16 18:32:38 +01:00
Björn Linse
c7a65fe6a1 buffer_updates: autoload episode III: revenge of the trees 2021-02-14 11:10:36 +01:00
Björn Linse
94622ca66b buffer updates: add on_reload callback and handle it in treesitter parser 2021-02-10 18:58:46 +01:00
Thomas Vigouroux
3094bb4e38 fix(buf_updates): send updates when putting past last line
Fixes #13710
2021-02-08 19:08:42 +01:00
Björn Linse
209fb35acd tests: clean up lua/buffer_updates_spec.lua 2021-02-04 14:35:30 +01:00
Björn Linse
aa50369897 inccommand: preserve extmarks when undoing preview substitution 2021-02-04 14:33:37 +01:00
Michael Lingelbach
563d7b694b tests: add test for cursor postion when deleting buffer lines 2021-01-31 12:43:48 -08:00
Björn Linse
39d098f9f9 api: set_text: fix some byte count issues
add byte count tests

update documentation
2021-01-01 19:51:58 +01:00
Thomas Vigouroux
25e20da550
feat(buffer_updates): allow ignoring when previewing
Also adds a test that we actually subscribe to buffer events when in
CMDPREVIEW.
2020-12-15 22:29:27 +01:00
Björn Linse
0b615dae07 api: multiple decoration providers at once 2020-10-10 15:16:45 +02:00
KillTheMule
02dcc3c11a Fix byte updates for blockwise paste at buffer end 2020-09-30 21:28:21 +02:00
Thomas Vigouroux
c1a740ae33 bytetrack: add blockwise paste test 2020-09-30 20:10:06 +02:00