aboutsummaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAge
...
* | feat(extmark): support proper multiline rangesbfredl2023-09-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The removes the previous restriction that nvim_buf_set_extmark() could not be used to highlight arbitrary multi-line regions The problem can be summarized as follows: let's assume an extmark with a hl_group is placed covering the region (5,0) to (50,0) Now, consider what happens if nvim needs to redraw a window covering the lines 20-30. It needs to be able to ask the marktree what extmarks cover this region, even if they don't begin or end here. Therefore the marktree needs to be augmented with the information covers a point, not just what marks begin or end there. To do this, we augment each node with a field "intersect" which is a set the ids of the marks which overlap this node, but only if it is not part of the set of any parent. This ensures the number of nodes that need to be explicitly marked grows only logarithmically with the total number of explicitly nodes (and thus the number of of overlapping marks). Thus we can quickly iterate all marks which overlaps any query position by looking up what leaf node contains that position. Then we only need to consider all "start" marks within that leaf node, and the "intersect" set of that node and all its parents. Now, and the major source of complexity is that the tree restructuring operations (to ensure that each node has T-1 <= size <= 2*T-1) also need to update these sets. If a full inner node is split in two, one of the new parents might start to completely overlap some ranges and its ids will need to be moved from its children's sets to its own set. Similarly, if two undersized nodes gets joined into one, it might no longer completely overlap some ranges, and now the children which do needs to have the have the ids in its set instead. And then there are the pivots! Yes the pivot operations when a child gets moved from one parent to another.
* | fix(decorations): better approximation of botline #24794Jaehwang Jung2023-09-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: * The guessed botline might be smaller than the actual botline e.g. when there are folds and the user is typing in insert mode. This may result in incorrect treesitter highlights for injections. * botline can be larger than the last line number of the buffer, which results in errors when placing extmarks. Solution: * Take a more conservative approximation. I am not sure if it is sufficient to guarantee correctness, but it seems to be good enough for the case mentioned above. * Clamp it to the last line number. Co-authored-by: Lewis Russell <me@lewisr.dev>
* | refactor(usercmd.c): reduce scope of localsLewis Russell2023-09-11
| |
* | Merge pull request #25083 from bfredl/memlinetypebfredl2023-09-11
|\ \ | | | | | | refactor(memline): cleanup typedefs for memline structs
| * | refactor(memline): cleanup typedefs for memline structsbfredl2023-09-10
| | | | | | | | | | | | | | | These were used interchangedly by the struct name and the typedef name. Use standard pattern type names and use these consistently
* | | fix(api): more intuitive cursor updates in nvim_buf_set_textSergey Slipchenko2023-09-11
| | | | | | | | | | | | Fixes #22526
* | | fix(mouse): click on 'statuscolumn' with 'rightleft' (#25090)zeertzjq2023-09-11
|/ /
* | refactor(mch): last mch_ function/macro hits the dustbfredl2023-09-10
| | | | | | | | Also remove some stray comments.
* | refactor(memfile): change mf_trans and mf_hash from ad-hoc hashtable to Mapbfredl2023-09-10
| | | | | | | | | | | | | | | | | | | | Memfile used a private implementation of an open hash table with intrusive collision chains, but there is no reason to assume the standard khash_t based Map won't work just fine. Yes, we are taking full ownership and maintenance over memline and memfile. No one is going to maintain it for us. Trust the plan.
* | fix: fix compiler warning from clangdundargoc2023-09-09
| |
* | fix(rpc): fix hang with channel closed while waiting for responseSergey Slipchenko2023-09-09
| |
* | Merge pull request #25039 from glepnir/fix_hlbfredl2023-09-09
|\ \ | | | | | | fix(highlight): add create param in nvim_get_hl api function
| * | fix(highlight): add create param in nvim_get_hlglepnir2023-09-09
| |/
* | vim-patch:partial:9.0.1886: Various Typoszeertzjq2023-09-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Various Typos Solution: Fix Typos This is a collection of typo related commits. closes: vim/vim#12753 closes: vim/vim#13016 https://github.com/vim/vim/commit/ee17b6f70d382ec6c5d8d27b56c4e84106ac8c55 Co-authored-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Adri Verhoef <a3@a3.xs4all.nl> Co-authored-by: Viktor Szépe <viktor@szepe.net> Co-authored-by: nuid64 <lvkuzvesov@proton.me> Co-authored-by: Meng Xiangzhuo <aumo@foxmail.com> Co-authored-by: Dominique Pellé <dominique.pelle@gmail.com>
* | vim-patch:9.0.1877: missing test for patch 9.0.1873zeertzjq2023-09-09
|/ | | | | | | | | | | | Problem: missing test for patch 9.0.1873 Solution: add a test trying to exchange windows Add a test, making sure that switching windows is not allowed when textlock is active, e.g. when running `:s/<pat>/\=func()/` https://github.com/vim/vim/commit/18d2709aa12ffa3f6ae1a13059990558c5f8e406 Co-authored-by: Christian Brabandt <cb@256bit.org>
* vim-patch:9.0.1884: Wrong order of arguments for error messages (#25055)zeertzjq2023-09-09
| | | | | | | | | | Problem: Wrong order of arguments for error messages Solution: Reverse order or arguments for e_aptypes_is_null_nr_str closes: vim/vim#13051 https://github.com/vim/vim/commit/1bd2cb11694690a77e4141bce2e34d9dfb882f1c Co-authored-by: Christ van Willegen <cvwillegen@gmail.com>
* refactor(map): enhanced implementation, Clean Code™, etc etcbfredl2023-09-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This involves two redesigns of the map.c implementations: 1. Change of macro style and code organization The old khash.h and map.c implementation used huge #define blocks with a lot of backslash line continuations. This instead uses the "implementation file" .c.h pattern. Such a file is meant to be included multiple times, with different macros set prior to inclusion as parameters. we already use this pattern e.g. for eval/typval_encode.c.h to implement different typval encoders reusing a similar structure. We can structure this code into two parts. one that only depends on key type and is enough to implement sets, and one which depends on both key and value to implement maps (as a wrapper around sets, with an added value[] array) 2. Separate the main hash buckets from the key / value arrays Change the hack buckets to only contain an index into separate key / value arrays This is a common pattern in modern, state of the art hashmap implementations. Even though this leads to one more allocated array, it is this often is a net reduction of memory consumption. Consider key+value consuming at least 12 bytes per pair. On average, we will have twice as many buckets per item. Thus old implementation: 2*12 = 24 bytes per item New implementation 1*12 + 2*4 = 20 bytes per item And the difference gets bigger with larger items. One might think we have pulled a fast one here, as wouldn't the average size of the new key/value arrays be 1.5 slots per items due to amortized grows? But remember, these arrays are fully dense, and thus the accessed memory, measured in _cache lines_, the unit which actually matters, will be the fully used memory but just rounded up to the nearest cache line boundary. This has some other interesting properties, such as an insert-only set/map will be fully ordered by insert only. Preserving this ordering in face of deletions is more tricky tho. As we currently don't use ordered maps, the "delete" operation maintains compactness of the item arrays in the simplest way by breaking the ordering. It would be possible to implement an order-preserving delete although at some cost, like allowing the items array to become non-dense until the next rehash. Finally, in face of these two major changes, all code used in khash.h has been integrated into map.c and friends. Given the heavy edits it makes no sense to "layer" the code into a vendored and a wrapper part. Rather, the layered cake follows the specialization depth: code shared for all maps, code specialized to a key type (and its equivalence relation), and finally code specialized to value+key type.
* fix(options): correct condition for calling did_set_option() (#25026)zeertzjq2023-09-05
|
* vim-patch:9.0.1866: undo is synced after character find (#25021)zeertzjq2023-09-05
| | | | | | | | | | | vim-patch:9.0.1866: undo is synced after character find Problem: Undo is synced after character find. Solution: Set no_u_sync when calling gotchars_nop(). closes: vim/vim#13022 closes: vim/vim#13024 https://github.com/vim/vim/commit/dccc29c228f8336ef7dd069a447886639af4458e
* vim-patch:9.0.1863: wrong format specifiers in e_aptypes_is_null_str_nr (#25015)zeertzjq2023-09-04
| | | | | | | | Problem: wrong format specifiers in e_aptypes_is_null_str_nr Solution: Fix the wrong format specifier closes: vim/vim#13020 https://github.com/vim/vim/commit/7db89bdc23e53c7bc43af6f1c7281bc69a6a3098
* vim-patch:9.0.1856: issues with formatting positional arguments (#25013)zeertzjq2023-09-04
| | | | | | | | | | | | | Problem: issues with formatting positional arguments Solution: fix them, add tests and documentation closes: vim/vim#12140 closes: vim/vim#12985 Tentatively fix message_test. Check NULL ptr. https://github.com/vim/vim/commit/aa90d4f031f73a34aaef5746931ea746849a2231 Co-authored-by: Christ van Willegen <cvwillegen@gmail.com>
* build: various fixesdundargoc2023-09-04
| | | | | | | | | - simplify lua interpreter search - fix incorrect variable name in BuildLua.cmake - build PUC Lua with -O2 - silence non-mandatory find_package search for libuv - simplify Find modules - Prefer using the explicitly set CI_BUILD over relying on the environment variable "CI".
* Merge pull request #24974 from bfredl/memline2bfredl2023-09-03
|\ | | | | fix(memline): more curbuf stuff
| * fix(memline): more curbuf stuffbfredl2023-09-01
| |
* | refactor(ex_session.c): remove unnecessary char -> int -> char castzeertzjq2023-09-03
| | | | | | | | The two calls to get_view_file() both pass a char in a string, and get_view_file() assigns it to a char in a string.
* | vim-patch:9.0.1848: [security] buffer-overflow in vim_regsub_both() (#25001)zeertzjq2023-09-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: buffer-overflow in vim_regsub_both() Solution: Check remaining space https://github.com/vim/vim/commit/ced2c7394aafdc90fb7845e09b3a3fee23d48cb1 The change to do_sub() looks confusing. Maybe it's an overflow check? Then the crash may not be applicable to Nvim because of different casts. The test also looks confusing. It seems to source itself recursively. Also don't call strlen() twice on evaluation result. N/A patches for version.c: vim-patch:9.0.1849: CI error on different signedness in ex_cmds.c vim-patch:9.0.1853: CI error on different signedness in regexp.c Co-authored-by: Christian Brabandt <cb@256bit.org>
* | perf(substitute): don't reallocate new_start every time (#24997)zeertzjq2023-09-03
| |
* | vim-patch:9.0.1840: [security] use-after-free in do_ecmd (#24993)zeertzjq2023-09-03
| | | | | | | | | | | | | | | | | | | | | | Problem: use-after-free in do_ecmd Solution: Verify oldwin pointer after reset_VIsual() https://github.com/vim/vim/commit/e1dc9a627536304bc4f738c21e909ad9fcf3974c N/A patches for version.c: vim-patch:9.0.1841: style: trailing whitespace in ex_cmds.c Co-authored-by: Christian Brabandt <cb@256bit.org>
* | refactor(marks): don't set timestamp twice with :delmarks (#24994)zeertzjq2023-09-03
| | | | | | refactor(mark): don't set same timestamp twice
* | fix(shada): update marks when using delmarks! (#24978)Maria José Solano2023-09-03
| |
* | vim-patch:9.0.1847: [security] potential oob write in do_addsub()zeertzjq2023-09-03
| | | | | | | | | | | | | | | | | | Problem: potential oob write in do_addsub() Solution: don't overflow buf2, check size in for loop() https://github.com/vim/vim/commit/889f6af37164775192e33b233a90e86fd3df0f57 Co-authored-by: Christian Brabandt <cb@256bit.org>
* | vim-patch:9.0.1846: [security] crash in fullcommandzeertzjq2023-09-03
| | | | | | | | | | | | | | | | | | Problem: crash in fullcommand Solution: Check for typeval correctly https://github.com/vim/vim/commit/4c6fe2e2ea62469642ed1d80b16d39e616b25cf5 Co-authored-by: Christian Brabandt <cb@256bit.org>
* | vim-patch:9.0.1852: i_CTRL-O does not reset Select Mode (#24990)zeertzjq2023-09-03
| | | | | | | | | | | | | | | | | | | | | | | | Problem: i_CTRL-O does not reset Select Mode Solution: Reset select mode on CTRL-O in insert mode closes: vim/vim#13001 closes: vim/vim#12115 https://github.com/vim/vim/commit/d69aecf141ff05a645d02f39f1cbf6381ed7d0c0 Co-authored-by: pierreganty <pierreganty@gmail.com> Co-authored-by: Christian Brabandt <cb@256bit.org>
* | build: download busted from own neovim/deps repositorydundargoc2023-09-03
| | | | | | | | | | | | | | | | Downloading the necessary files all at once instead of doing dependency handling with luarocks speeds up installation immensely. We speed up the process even more by using luv as a replacement for the C modules in the busted dependencies, which allows us to skip costly compilation times. Co-authored-by: bfredl <bjorn.linse@gmail.com>
* | fix(ui): avoid ambiguity about chunk that clears part of line (#24982)zeertzjq2023-09-02
| | | | | | Co-authored-by: bfredl <bjorn.linse@gmail.com>
* | Merge pull request #24310 from lewis6991/refactor/optionvalidateLewis Russell2023-09-02
|\ \ | |/ |/| refactor(option.c): misc
| * refactor(option): add set_option()Lewis Russell2023-08-31
| |
| * refactor(option): pass varp to set_string_optionLewis Russell2023-08-31
| |
| * refactor(option): option clearingLewis Russell2023-08-31
| |
| * refactor(option): remove OPT_CLEARLewis Russell2023-08-31
| |
| * refactor(option): further align set_string_option with do_set_option_string (2)Lewis Russell2023-08-31
| |
| * refactor(option): further align set_string_option with do_set_option_stringLewis Russell2023-08-31
| |
| * refactor(option): remove hidden option checkLewis Russell2023-08-31
| |
| * refactor(option): remove redundant localLewis Russell2023-08-31
| |
| * refactor(option): change some int to boolLewis Russell2023-08-31
| |
| * refactor(option.c): call did_set_option for all typesLewis Russell2023-08-31
| | | | | | | | | | | | | | | | set_option_value() only called did_set_option() for string options, whereas do_set_option_value() called it for all types. This change makes set_option_value() call did_set_option() for all types and thus makes it more consistent with do_set_option_value().
| * fix(optionstr.c): incorrect use of curbuf/curwinLewis Russell2023-08-31
| |
| * refactor(optionstr.c): remove redundant argumentLewis Russell2023-08-31
| |
| * refactor(option.c): remove did_set_string_option aliasLewis Russell2023-08-31
| |
| * refactor(option.c): move validation logic to functionLewis Russell2023-08-31
| |