aboutsummaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAge
...
| * | | | | | fix(stream): do not close handle if it is already closing (#26537)Gregory Anders2023-12-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | uv_close asserts that a handle is not already closing. We can guard against this assertion failure by manually checking the handle's closing status ourselves.
| * | | | | | fix(lua): memory leak when using invalid syntax with exists() (#26530)zeertzjq2023-12-12
| | | | | | |
| * | | | | | feat(eval): exists() function supports checking v:lua functions (#26485)Raphael2023-12-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Vimscript function exists() can't check v:lua functions. Solution: Add support for v:lua functions to exists().
| * | | | | | Merge pull request #26486 from glepnir/fix_linebytebfredl2023-12-12
| |\ \ \ \ \ \ | | | | | | | | | | | | | | | | fix(eval): use no_ff instead of ffdos as condition
| | * | | | | | fix: use no_ff instead of ffdos as conditionglepnir2023-12-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: line2byte behavior is changed after commit b051b13. It no longer return `-1` on empty buffer. Solution: use `nof_ff` instead of `!ff_dos` as condition. Then compatible behavior of line2byte() is restored.
| * | | | | | | fix(extmarks): `U` changed_bytes after extmark_splice (#26501)Jaehwang Jung2023-12-12
| | | | | | | | | | | | | | | | | | | | | | | | See also: https://github.com/neovim/neovim/pull/26364
| * | | | | | | fix(tui): don't forget to update cursor visibility (#26523)zeertzjq2023-12-12
| | | | | | | |
| * | | | | | | fix(coverity): unhandled retval for marktree_itr_get_overlap() #26518luukvbaal2023-12-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | buf_signcols_validate_range() is only called in a buffer with signs, in which the marktree is thus non-empty. Also remove a redundant comment, condition and variable. *** CID 470331: Error handling issues (CHECKED_RETURN) /src/nvim/decoration.c: 824 in buf_signcols_validate_range() 818 819 // Allocate an array of integers holding the overlapping signs in the range. 820 assert(row2 >= row1); 821 int *overlap = xcalloc(sizeof(int), (size_t)(row2 + 1 - row1)); 822 823 // First find the number of overlapping signs at "row1". >>> CID 470331: Error handling issues (CHECKED_RETURN) >>> Calling "marktree_itr_get_overlap" without checking return value (as is done elsewhere 4 out of 5 times). 824 marktree_itr_get_overlap(buf->b_marktree, currow, 0, itr); 825 while (marktree_itr_step_overlap(buf->b_marktree, itr, &pair)) { 826 if (!mt_invalid(pair.start) && pair.start.flags & MT_FLAG_DECOR_SIGNTEXT) { 827 overlap[0]++; 828 } 829 }
| * | | | | | | Merge pull request #26458 from famiu/refactor/options/optionindexdundargoc2023-12-10
| |\ \ \ \ \ \ \
| | * | | | | | | refactor(options): define `kOptIndexCount`Famiu Haque2023-12-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a macro to indicate the option count so that we can iterate through the options[] table more clearly. This also removes the need for having an option with NULL fullname at the end of `options[]`.
| | * | | | | | | refactor(options): convert `opt_idx` variables to `OptIndex`Famiu Haque2023-12-09
| | | | | | | | |
| | * | | | | | | refactor(options): reduce `findoption()` usageFamiu Haque2023-12-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Many places in the code use `findoption()` to access an option using its name, even if the option index is available. This is very slow because it requires looping through the options array over and over. Solution: Use option index instead of name wherever possible. Also introduce an `OptIndex` enum which contains the index for every option as enum constants, this eliminates the need to pass static option names as strings.
| * | | | | | | | build: remove config-specific find_package search for libuvdundargoc2023-12-09
| |/ / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | Having two separate find_package calls makes it harder to maintain.
| * | | | | | | refactor: format casting of negative number better (#26482)zeertzjq2023-12-09
| | | | | | | |
| * | | | | | | refactor(tui): use synchronized updates around actual buf flush (#26478)Gregory Anders2023-12-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rather than writing the synchronized update begin and end sequences into the TUI's internal buffer (where it is later flushed to the TTY), write these sequences directly to the TTY before and after the TUI's internal buffer is itself flushed to the TTY. This guarantees that a synchronized update is always used when we are actually sending data to the TTY. This means we do not need to keep track of the TUI's "dirty" state (any sequences which affect the TUI state will be written in the TUI's internal buffer, which is now guaranteed to only ever be written when a synchronized update is active).
| * | | | | | | vim-patch:9.0.2154: The option[] array is not sorted (#26475)zeertzjq2023-12-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: The options[] array is not sorted alphabetically. Solution: Sort it alphabetically. Add a test. Avoid unnecessary loop iterations in findoption(). closes: vim/vim#13648 Cherry-pick Test_set_one_column() change from patch 8.2.0432. https://github.com/vim/vim/commit/f48558e10a08a1a483e25ef847bbceeac6b44561
| * | | | | | | perf(column): avoid counting when max signs are removed from a rangeLuuk van Baal2023-12-08
| | | | | | | |
| * | | | | | | fix(tui): start flush earlier (#26463)zeertzjq2023-12-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: TUI flush (start sync or hide cursor) only starts on a "flush" event, which is too late. Solution: Start the next flush when anything will be drawn.
| * | | | | | | Merge pull request #26456 from gpanders/ignore-vim-runtimeGregory Anders2023-12-07
| |\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | fix(terminal): ignore $VIM and $VIMRUNTIME in pty jobs
| | * | | | | | | fix(terminal): ignore $VIM and $VIMRUNTIME in pty jobsGregory Anders2023-12-07
| | | | | | | | |
| * | | | | | | | refactor(options): split `get_option_value()` into smaller functionsFamiu Haque2023-12-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Currently, `get_option_value()` returns 3 separate things: The actual value of the option, whether the option is hidden, and the option flags. This makes the function difficult to refactor, modify or otherwise reason about. Solution: Split `get_option_value()` into 3 functions, each with a single purpose. This also affects `get_option_value_for()`.
| * | | | | | | | fix(lua): allow nil values in serialized Lua arrays (#26329)Gregory Anders2023-12-07
| |/ / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we convert a Lua table to an Object, we consider the table a "dictionary" if it contains only string keys, and an array if it contains all numeric indices with no gaps. While rare, Lua tables can have both strictly numeric indices and gaps (e.g. { [2] = 2 }). These currently cannot be serialized because it is not considered an array. However, we know the maximum index of the table and as long as all of the keys in the table are numeric, it is still possible to serialize this table as an array. The missing indices will have nil values.
| * | | | | | | perf(column): keep track of number of lines that hold up the 'signcolumn'Luuk van Baal2023-12-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: The entire marktree needs to be traversed each time a sign is removed from the sentinel line. Solution: Remove sentinel line and instead keep track of the number of lines that hold up the 'signcolumn' in "max_count". Adjust this number for added/removed signs, and set it to 0 when the maximum number of signs on a line changes. Only when "max_count" is decremented to 0 due to sign removal do we need to check the entire buffer. Also replace "invalid_top" and "invalid_bot" with a map of invalid ranges, further reducing the number of lines to be checked. Also improve tree traversal when counting the number of signs. Instead of looping over the to be checked range and counting the overlap for each row, keep track of the overlap in an array and add this to the count.
| * | | | | | | refactor: object_to_vim() cannot failJustin M. Keyes2023-12-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since the parent commit, object_to_vim() can't fail, so callers don't need to check its result.
| * | | | | | | feat(rpc): allow empty string key in msgpack => Vim conversionJustin M. Keyes2023-12-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Since e057b38e7037 #20757 we support empty key in JSON encode/decode, but we don't allow it in RPC object => Vim dict conversion. But empty string is a valid key in Vim dicts and the msgpack spec. Empty string key was disallowed in 7c01d5ff9286 (2014) but that commit/PR doesn't explicitly discuss it, so presumably it was a "seems reasonable" decision (or Vimscript didn't allow empty keys until later). Solution: Remove the check in `object_to_vim()`. Note that `tv_dict_item_alloc_len` will invoke `memcpy(…, 0)` but that's allowed by the C spec: https://stackoverflow.com/a/3751937/152142
| * | | | | | | Merge pull request #26438 from jamessan/log_spec-nameJames McCoy2023-12-07
| |\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | fix(log): increase size of buffer for nvim instance name
| | * | | | | | | fix(log): increase size of buffer for nvim instance nameJames McCoy2023-12-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 16 bytes is not enough room for existing usage of the buffer by the tests, so the name may get truncated and cause log_spec test to fail: FAILED test/functional/core/log_spec.lua @ 30: log messages are formatted with name or test id test/helpers.lua:146: retry() attempts: 51 test/helpers.lua:155: Pattern "%.%d+%.%d/c +server_init:%d+: test log message" not found in log (last 100 lines): Xtest_logging: ERR 2023-11-24T23:36:34.252 T1274.2445945.0 server_init:57: test log message ERR 2023-11-24T23:36:34.275 T1274.2445945.0 server_init:57: test log message
| * | | | | | | | fix(terminal): never propagate $COLORTERM from outer env (#26440)zeertzjq2023-12-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If $COLORTERM is "truecolor" but the user sets 'notermguicolors', propagating $COLORTERM to :terminal usually doesn't work well.
| * | | | | | | | fix(inccommand): don't crash with "split" and 'n' flagzeertzjq2023-12-07
| | | | | | | | |
| * | | | | | | | fix(inccommand): save and restore '[ and '] marks (#26442)zeertzjq2023-12-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Undoing a change moves '[ and '] marks, so it is necessary to save and restore them.
| * | | | | | | | version.c: update (#26441)github-actions[bot]2023-12-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | Co-authored-by: marvim <marvim@users.noreply.github.com>
| * | | | | | | | fix(tui): use uv_timer_t instead of TimeWatcher for input (#26435)zeertzjq2023-12-07
| |/ / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Avoid scheduling on main loop. Fix #26425
| * | | | | | | Merge pull request #26381 from bfredl/delaycolorsbfredl2023-12-06
| |\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | fix(startup): only send one default_colors_set event during startup
| | * | | | | | | fix(startup): only send one default_colors_set event during startupbfredl2023-12-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the color scheme is changed in a startup script, nvim used to send multiple default_colors_set events, one for the default color scheme and one for the user's chosen color scheme. This would cause flicker in some UI:s. Throttle this event until we actually start drawing on the screen. fixes #26372
| * | | | | | | | Merge pull request #26407 from gpanders/default-tgcGregory Anders2023-12-06
| |\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | feat(defaults): enable 'termguicolors' by default when supported by terminal
| | * | | | | | | | feat(defaults): enable 'termguicolors' by default when supported by terminalGregory Anders2023-12-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Enable 'termguicolors' automatically when Nvim can detect that truecolor is supported by the host terminal. If $COLORTERM is set to "truecolor" or "24bit", or the terminal's terminfo entry contains capabilities for Tc, RGB, or setrgbf and setrgbb, then we assume that the terminal supports truecolor. Otherwise, the terminal is queried (using both XTGETTCAP and SGR + DECRQSS). If the terminal's response to these queries (if any) indicates that it supports truecolor, then 'termguicolors' is enabled.
| * | | | | | | | | fix(json): allow objects with empty keys #25564Emanuel2023-12-06
| | |/ / / / / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Empty string is a valid JSON key, but json_decode() treats an object with empty key as ":help msgpack-special-dict". #20757 :echo json_decode('{"": "1"}') {'_TYPE': [], '_VAL': [['', '1']]} Note: vim returns `{'': '1'}`. Solution: Allow empty string as an object key. Note that we still (currently) disallow empty keys in object_to_vim() (since 7c01d5ff9286d262097484c680e3a4eab49e2911): https://github.com/neovim/neovim/blob/f64e4b43e1191ff30d902730f752875aa55682ce/src/nvim/api/private/converter.c#L333-L334 Fix #20757 Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
| * | | | | | | | fix(treesitter): don't forcefully open foldsJaehwang Jung2023-12-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: When `vim._foldupdate()` is invoked inside a scheduled callback, the cursor may have moved to a line with a closed fold, e.g., after `dd` on the line that is one line above a folded region. Then it opens the fold, which is unnecessary and distracting. Legacy foldexprs do not have this issue. Solution: Don't explicitly open folds on cursor. Note: This doesn't completely prevent spurious opening of folds. That is due to bugs in treesitter foldexpr algorithm, which should be addressed separately.
| * | | | | | | | vim-patch:8.2.3695: confusing error for missing key (#26420)zeertzjq2023-12-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Confusing error for missing key. Solution: Use the actualy key for the error. (closes vim/vim#9241) https://github.com/vim/vim/commit/5c1ec439f0a69e9aa7ece9bbb7d916f48f58be1e Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * | | | | | | | vim-patch:8.1.1583: set_ref_in_list() only sets ref in items (#26418)zeertzjq2023-12-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Set_ref_in_list() only sets ref in items. Solution: Rename to set_ref_in_list_items() to avoid confusion. https://github.com/vim/vim/commit/7be3ab25891fec711d8a2d9d242711a9155852b6 Omit set_ref_in_list() and set_ref_in_dict(): only used in popup window, if_pyth and if_lua. Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * | | | | | | | refactor(options): remove SOPT type enums (#26417)Famiu Haque2023-12-06
| |/ / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: SOPT type enums (`SOPT_NUM`, `SOPT_BOOL`, `SOPT_STRING`) are no longer used anywhere. Solution: Remove them.
| * | | | | | | docs: small fixes (#26243)dundargoc2023-12-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Co-authored-by: umlx5h <umlx5h21@protonmail.com> Co-authored-by: Gregory Anders <greg@gpanders.com> Co-authored-by: Evan Farrar <evan@evanfarrar.com>
| * | | | | | | vim-patch:9.0.2151: 'breakindent' is not drawn after diff filler lines (#26412)zeertzjq2023-12-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: 'breakindent' is not drawn after diff filler lines. Solution: Correct check for whether 'breakindent' should be drawn. closes: vim/vim#13624 https://github.com/vim/vim/commit/588f20decebebedba3ad733f4f443a597e9747c3 Cherry-pick Test_diff_with_syntax() change from patch 9.0.1257.
| * | | | | | | test: fileio_spec is unreliable/flaky #26404Justin M. Keyes2023-12-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: CI sometimes fails. Something is triggering an extra fsync(). FAILED test/functional/core/fileio_spec.lua @ 52: fileio fsync() codepaths #8304 test/functional/core/fileio_spec.lua:87: Expected objects to be the same. Passed in: (number) 3 Expected: (number) 2 stack traceback: test/functional/core/fileio_spec.lua:87: in function <test/functional/core/fileio_spec.lua:52> Solution: Relax the assertion to `fsync >= 2` instead of exactly 2. (Note this is not a behavior change: the next assertion has always checked `fsync == 4`, it's just that the intermediate 3rd fsync was never explicitly asserted.)
| * | | | | | | Merge pull request #26361 from luukvbaal/invalidbfredl2023-12-05
| |\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | fix(extmarks): restore old position before revalidating
| | * | | | | | | fix(extmarks): restore old position before revalidatingLuuk van Baal2023-12-02
| | | | | | | | |
| * | | | | | | | refactor(IWYU): move marktree types to marktree_defs.h (#26402)zeertzjq2023-12-05
| | |/ / / / / / | |/| | | | | |
| * | | | | | | refactor(api): complete conversion from `Dictionary` to `Dict(opts)` (#26365)Riccardo Mazzarini2023-12-05
| | | | | | | |
| * | | | | | | fix(change): update fold after on_bytes (#26364)Jaehwang Jung2023-12-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: With vim.treesitter.foldexpr, `o`-ing two lines above a folded region opens the fold. This does not happen with legacy foldexprs. For example, make a markdown file with the following text (without indentation), enable treesitter fold, and follow the instruction in the text. put cursor on this line and type zoo<Esc> initially folded, revealed by zo # then this fold will be opened initially folded, revealed by o<Esc> Analysis: * `o` updates folds first (done in `changed_lines`), evaluating foldexpr, and then invokes `on_bytes` (done in `extmark_splice`). * Treesitter fold allocates the foldinfo for added lines (`add_range`) on `on_bytes`. * Therefore, when treesitter foldexpr is invoked while running `o`, it sees outdated foldinfo. Solution: `extmark_splice`, and then `changed_lines`. This seems to be the standard order in other places, e.g., `nvim_buf_set_lines`.
| * | | | | | | build: enable lintlua for src/ dir #26395Justin M. Keyes2023-12-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Not all Lua code is checked by stylua. Automating code-style is an important mechanism for reducing time spent on accidental (non-essential) complexity. Solution: - Enable lintlua for `src/` directory. followup to 517f0cc634b985057da5b95cf4ad659ee456a77e