aboutsummaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAge
...
* fix(extmarks): fix wrong highlight after "combine" virt_text (#24281)Ibby2023-07-08
|
* feat(lua): allow vim.wo to be double indexed (#20288)Lewis Russell2023-07-07
| | | | | | | | * feat(lua): allow vim.wo to be double indexed Problem: `vim.wo` does not implement `setlocal` Solution: Allow `vim.wo` to be double indexed Co-authored-by: Christian Clason <c.clason@uni-graz.at>
* fix(treesitter): update folds in all relevant windows (#24230)Jaehwang Jung2023-07-07
| | | | | | | | | Problem: When using treesitter foldexpr, * :diffput/get open diff folds, and * folds are not updated in other windows that contain the updated buffer. Solution: Update folds in all windows that contain the updated buffer and use expr foldmethod.
* fix(folds): fix missing virt_lines above when fold is hidden (#24274)zeertzjq2023-07-07
|
* fix(drawline): inline virt_text hl_mode inside syntax/extmark hl (#24273)zeertzjq2023-07-07
|
* fix(vim.system): close check handle (#24270)zeertzjq2023-07-06
| | | Fix hang after running vim.system() with sanitizers.
* fix(column): fix wrong cursor with 'statuscolumn' and cpo+=n (#24268)zeertzjq2023-07-06
|
* fix(ui): delay win_viewport until screen update #24182fredizzimo2023-07-05
| | | | | | | | | | | | | | | | | | | | | | | | Problem: Sometimes, when nvim sends the `win_viewport` event, for example when scrolling with visible folds on the screen, it reports the `scroll_delta` value one batch into "future". So when the client application is trying to show the new viewport it's not yet updated, resulting in temporary corruption / screen flickering. For more details see #23609, and starting from [this comment]( https://github.com/neovide/neovide/pull/1790#issuecomment-1518697747) in https://github.com/neovide/neovide/pull/1790,, where the issue was first detected. Note that some of the conclusions in those are not fully accurate, but the general observations are. Solution: When there are pending updates to a Window, delay the `win_viewport` UI event until the updates are sent. This ensures that there's no flush between sending the viewport and updating of the lines corresponding to the new viewport. Document the existing viewport behaviour (for cases where there are no extra flushes), give a hint about how applications can deal with the slightly surprising behaviour of the viewport event being sent after the updates. Fixes https://github.com/neovim/neovim/issues/23609
* Merge pull request #23228 from seandewar/cmdwin-jailzeertzjq2023-07-05
|\ | | | | fix(api): use `text_locked()` to check for textlock
| * fix(api): disallow some more functions during textlockSean Dewar2023-07-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: nvim_buf_set_text(), nvim_open_term() and termopen() all change buffer text, which is forbidden during textlock. Additionally, nvim_open_term() and termopen() may be used to convert the cmdwin buffer into a terminal buffer, which is weird. Solution: Allow nvim_buf_set_text() and nvim_open_term() in the cmdwin, but disallow nvim_open_term() from converting the cmdwin buffer into a terminal buffer. termopen() is not allowed in the cmdwin (as it always operates on curbuf), so just check text_locked(). Also happens to improve the error in #21055: nvim_buf_set_text() was callable during textlock, but happened to check textlock indirectly via u_save(); however, this caused the error to be overwritten by an unhelpful "Failed to save undo information" message when msg_list == NULL (e.g: an `<expr>` mapping invoked outside of do_cmdline()).
| * fix(api): use text_locked() to check textlockSean Dewar2023-07-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: some API functions that check textlock (usually those that can change curwin or curbuf) can break the cmdwin. Solution: make FUNC_API_CHECK_TEXTLOCK call text_locked() instead, which already checks for textlock, cmdwin and `<expr>` status. Add FUNC_API_TEXTLOCK_ALLOW_CMDWIN to allow such functions to be usable in the cmdwin if they can work properly there; the opt-in nature of this attribute should hopefully help mitigate future bugs. Also fix a regression in #22634 that made functions checking textlock usable in `<expr>` mappings, and rename FUNC_API_CHECK_TEXTLOCK to FUNC_API_TEXTLOCK.
* | fix(plines): don't return very large height on very long line (#24260)zeertzjq2023-07-05
| |
* | Merge #23401 vim.ui.open: "gx" without netrwJustin M. Keyes2023-07-05
|\ \ | |/ |/|
| * fix(vim.ui.open): return (don't show) error messageJustin M. Keyes2023-07-05
| | | | | | | | | | | | | | | | | | | | Problem: Showing an error via vim.notify() makes it awkward for callers such as lsp/handlers.lua to avoid showing redundant errors. Solution: Return the message instead of showing it. Let the caller decide whether and when to show the message.
| * fix(gx): visual selection, expand env varsJustin M. Keyes2023-07-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | --- Rejected experiment: move vim.ui.open() to vim.env.open() Problem: `vim.ui` is where user-interface "providers" live, which can be overridden. It would also be useful to have a "providers" namespace for platform-specific features such as "open", clipboard, python, and the other providers listed in `:help providers`. We could overload `vim.ui` to serve that purpose as the single "providers" namespace, but `vim.ui.nodejs()` for example seems awkward. Solution: `vim.env` currently has too narrow of a purpose. Overload it to also be a namespace for `vim.env.open`. diff --git a/runtime/lua/vim/_meta.lua b/runtime/lua/vim/_meta.lua index 913f1fe20348..17d05ff37595 100644 --- a/runtime/lua/vim/_meta.lua +++ b/runtime/lua/vim/_meta.lua @@ -37,8 +37,28 @@ local options_info = setmetatable({}, { end, }) -vim.env = setmetatable({}, { - __index = function(_, k) +vim.env = setmetatable({ + open = setmetatable({}, { + __call = function(_, uri) + print('xxxxx'..uri) + return true + end, + __tostring = function() + local v = vim.fn.getenv('open') + if v == vim.NIL then + return nil + end + return v + end, + }) + }, + { + __index = function(t, k, ...) + if k == 'open' then + error() + -- vim.print({...}) + -- return rawget(t, k) + end local v = vim.fn.getenv(k) if v == vim.NIL then return nil
* | fix(edit): fix K_EVENT interfering with 'digraph' (#24258)zeertzjq2023-07-05
|/
* fix(api): allow negative column arguments for nvim_buf_set_text (#23501)notomo2023-07-04
|
* perf(ui-ext): approximate scroll_delta when scrolling too much (#24234)zeertzjq2023-07-04
|
* fix(ui-ext): "scroll_delta" handle topfill and skipcol (#24249)zeertzjq2023-07-04
|
* fix(api, lua): make blank lines in a message work properly (#24244)zeertzjq2023-07-04
|
* fix(plines): handle inline virtual text after last char (#24241)zeertzjq2023-07-03
| | | Also remove dead code in win_lbr_chartabsize().
* test: check for ASAN properly (#24224)zeertzjq2023-07-02
| | | Follow-up to #24195.
* vim-patch:9.0.1672: tabline highlight wrong after truncated double width ↵zeertzjq2023-07-02
| | | | | | | | label (#24223) Problem: Tabline highlight wrong after truncated double width label. Solution: Fill up half a double width character later. (closes vim/vim#12614) https://github.com/vim/vim/commit/d392a74c5a8af8271a33a20d37ae1a8ea422cb4b
* fix(startup)!: "nvim -l" message does not end with newline #24215zeertzjq2023-07-01
| | | Close #24180
* fix(api): nvim_parse_cmd error message in pcall() #23297Alexandre Teoi2023-07-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: nvim_parse_cmd() in pcall() may show an error message (side-effect): :lua pcall(vim.api.nvim_parse_cmd, vim.fn.getcmdline(), {}) E16: Invalid range Solution: Avoid emsg() in the nvim_parse_cmd() codepath. - refactor(api): add error message output parameter to get_address() - fix: null check emsg() parameter - refactor: remove emsg_off workaround from do_incsearch_highlighting() - refactor: remove emsg_off workaround from cmdpreview_may_show() - refactor: remove remaining calls to emsg() from parse_cmd_address() and get_address() - (refactor): lint set_cmd_dflall_range() - refactor: addr_error() - move output parameter to return value Fix #20339 TODO: These are the functions called by `get_address()`: ``` nvim_parse_cmd() -> parse_cmdline() -> parse_cmd_address() -> get_address() skipwhite() addr_error() qf_get_cur_idx() qf_get_cur_valid_idx() qf_get_size() qf_get_valid_size() mark_get() mark_check() assert() skip_regexp() magic_isset() > do_search() > searchit() ascii_isdigit() getdigits() getdigits_int32() compute_buffer_local_count() hasFolding() ``` From these functions, I found at least two that call emsg directly: - do_search() - seems to be simple to refactor - searchit() - will be more challenging because it may generate multiple error messages, which can't be handled by the current `errormsg` out-parameter. For example, it makes multiple calls to `vim_regexec_multi()` in a loop that possibly generate error messages, and later `searchit()` itself may generate another one: - https://github.com/neovim/neovim/blob/c194acbfc479d8e5839fa629363f93f6550d035c/src/nvim/search.c#L631-L647 - https://github.com/neovim/neovim/blob/c194acbfc479d8e5839fa629363f93f6550d035c/src/nvim/search.c#L939-L954 --------- Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
* feat(version): unverbose ":version", ":verbose version" #24195Justin M. Keyes2023-07-01
| | | | | | | | | Problem: `nvim -v` and `:version` prints system vimrc, fallback files, and compilation info by default, which most people don't care about and just clutters up the output. Solution: Omit extra info unless 'verbose' is set.
* feat(treesitter): bundle markdown parser and queries (#22481)Christian Clason2023-07-01
| | | | | | | * bundle split Markdown parser from https://github.com/MDeiml/tree-sitter-markdown * add queries from https://github.com/nvim-treesitter/nvim-treesitter/tree/main * upstream `#trim!` and `#inject-language!` directives Co-authored-by: dundargoc <gocdundar@gmail.com>
* fix(startup): don't truncate when printing with -l (#24216)zeertzjq2023-07-01
|
* Merge pull request #24147 from clason/fix/ftpluginzeertzjq2023-06-30
|\ | | | | fix(ftplugin): respect runtimepath ordering
| * test(lua/runtime_spec): add test for ftplugin orderingzeertzjq2023-06-30
| |
* | feat(lsp): move inlay_hint() to vim.lsp (#24130)Mathias Fußenegger2023-06-30
| | | | | | | | | | | | Allows to keep more functions hidden and gives a path forward for further inlay_hint related functions - like applying textEdits. See https://github.com/neovim/neovim/pull/23984#pullrequestreview-1486624668
* | fix(statusline): fill for double-width char after moving items (#24207)zeertzjq2023-06-30
| |
* | fix(column): handle unprintable chars in 'statuscolumn' (#24198)zeertzjq2023-06-29
| |
* | test(statusline): add test with control characters (#24197)zeertzjq2023-06-29
| |
* | fix(api): nvim_cmd{cmd="win_getid"} parsed as :winsize #24181Justin M. Keyes2023-06-28
| | | | | | | | | | | | | | | | Problem: `:lua vim.cmd.win_getid(30,10)` is interpreted as `:win[size] 30 10`. User intention was to call `vim.fn.win_getid(30,10)`. Solution: Check that the `cmd` actually matches the resolved command.
* | vim-patch:9.0.1670: resetting local option to global value is inconsistent ↵zeertzjq2023-06-28
| | | | | | | | | | | | | | | | | | | | | | (#24185) Problem: Resetting local option to global value is inconsistent. Solution: Handle "<" specifically for 'scrolloff' and 'sidescrolloff'. (closes vim/vim#12594) https://github.com/vim/vim/commit/bf5f189e449d6517239b79804d7a422a46946838 Co-authored-by: Bram Moolenaar <Bram@vim.org>
* | fix(treesitter): make foldexpr work without highlighting (#24167)Jaehwang Jung2023-06-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Treesitter fold is not updated if treesitter hightlight is not active. More precisely, updating folds requires `LanguageTree:parse()`. Solution: Call `parse()` before computing folds and compute folds when lines are added/removed. This doesn't guarantee correctness of the folds, because some changes that don't add/remove line won't update the folds even if they should (e.g. adding pair of braces). But it is good enough for most cases, while not introducing big overhead. Also, if highlighting is active, it is likely that `TSHighlighter._on_buf` already ran `parse()` (or vice versa).
* | vim-patch:9.0.1668: PEM files are not recognized (#24169)ObserverOfTime2023-06-27
| | | | | | | | | | | | Problem: PEM files are not recognized. Solution: Add patterns to match PEM files. (closes vim/vim#12582) https://github.com/vim/vim/commit/0256d76a3392aef270b38d1cf7633008e45c2003
* | vim-patch:9.0.1667: regression test doesn't fail when fix is revertedzeertzjq2023-06-27
| | | | | | | | | | | | | | | | Problem: Regression test doesn't fail when fix is reverted. Solution: Add "n" to 'cpoptions' instead of using :winsize. (closes vim/vim#12587, issue vim/vim#12528) https://github.com/vim/vim/commit/e42989374144a63d986b878618aeac328e35ac3b
* | vim-patch:9.0.1664: divide by zero when scrolling with 'smoothscroll' setzeertzjq2023-06-27
| | | | | | | | | | | | | | | | | | Problem: Divide by zero when scrolling with 'smoothscroll' set. Solution: Avoid using a negative width. (closes vim/vim#12540, closes vim/vim#12528) https://github.com/vim/vim/commit/8154e642aa476e1a5d3de66c34e8289845b2b797 Co-authored-by: fullwaywang <fullwaywang@tencent.com>
* | vim-patch:9.0.1632: not all cabal config files are recognized (#24025)Jonas Strittmatter2023-06-26
| | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Not all cabal config files are recognized. Solution: Add a couple of patterns. (Marcin Szamotulski, closes vim/vim#12463) https://github.com/vim/vim/commit/166cd7b801ebe4aa042a9bbd6007d1951800aaa9 Also: - Do not expand Lua patterns in environment variables used in file patterns. - Test $XDG_CONFIG_HOME on Windows, as it can be used by Nvim (and the runner sets it). Co-authored-by: Marcin Szamotulski <coot@coot.me>
* | fix(startup): "nvim -l foo.lua" may not set arg0 #24161Mike2023-06-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Using "nvim -l args.lua" without passing extra script args, does not set `_G.arg[0]`. Steps to reproduce: ``` cat > args.lua<<EOF vim.print(_G.arg, '') vim.print(vim.v.argv, '') EOF nvim --clean -l args.lua ``` Solution: Fix condition in command_line_scan.
* | fix(charset): fix wrong display of 0xffff (#24158)zeertzjq2023-06-26
| |
* | vim-patch:9.0.1665: empty CmdlineEnter autocommand causes errors in Ex modezeertzjq2023-06-26
| | | | | | | | | | | | | | | | | | | | Problem: Empty CmdlineEnter autocommand causes errors in Ex mode. Solution: Save and restore ex_pressedreturn. (Christian Brabandt, closes # 12581, closes vim/vim#12578) https://github.com/vim/vim/commit/590aae35575cbd74d80c41d87fc647f2812aad70 Co-authored-by: Christian Brabandt <cb@256bit.org>
* | Merge #24116 from justinmk/docJustin M. Keyes2023-06-25
|\ \
| * | fix(docs): vimdoc syntax errorsJustin M. Keyes2023-06-25
| | | | | | | | | | | | gen_help_html: truncate parse-error sample text
* | | vim-patch:9.0.1661: BUCK files are not recognized (#24142)Christian Clason2023-06-24
| |/ |/| | | | | | | | | | | | | Problem: BUCK files are not recognized. Solution: Recognize BUCK files as "bzl". (Son Luong Ngoc, closes vim/vim#12564) https://github.com/vim/vim/commit/b46e0f3263acd99c61df06ee3c4d1f6e0b471bc3 Co-authored-by: Son Luong Ngoc <sluongng@gmail.com>
* | test(extmarks): add a test for #23848 (#24140)zeertzjq2023-06-24
| |
* | Merge pull request #24082 from smjonas/fix_24064Christian Clason2023-06-24
|\ \ | | | | | | fix(filetype): correctly detect bash-fc-{id} files as "sh" (vim-patch:9.0.1644)
| * | vim-patch:9.0.1644: not all filetype file name matches are testedsmjonas2023-06-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Not all filetype file name matches are tested. Solution: Add more file names to test with. (Jonas Strittmatter, closes vim/vim#12569) https://github.com/vim/vim/commit/bd087ae8f07f026bbd179911830027ff92f42c01 Co-authored-by: smjonas <jonas.strittmatter@gmx.de>