aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
* Merge pull request #27808 from jamessan/gen_cflags-cleanupJames McCoy2024-03-12
|\ | | | | Cleanup construction of command-lines for header generation
| * fix: deduplicate gen_cflagsJames McCoy2024-03-10
| | | | | | | | | | Since many of the targets have common include paths, `gen_cflags` accumulates a lot of duplicate flags.
| * fix: ignore non-existent properties during header generationJames McCoy2024-03-10
| | | | | | | | | | | | | | `get_target_property(<var> ...)` sets `<var>` to `<var>-NOTFOUND` if the property doesn't exist for the given target. Detect this situation to avoid adding various `-Dprop-NOTFOUND` and `-Iprop-NOTFOUND` to the command-line when generating the headers.
* | feat(treesitter): support URLs (#27132)Gregory Anders2024-03-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Tree-sitter queries can add URLs to a capture using the `#set!` directive, e.g. (inline_link (link_text) @text.reference (link_destination) @text.uri (#set! @text.reference "url" @text.uri)) The pattern above is included by default in the `markdown_inline` highlight query so that users with supporting terminals will see hyperlinks. For now, this creates a hyperlink for *all* Markdown URLs of the pattern [link text](link url), even if `link url` does not contain a valid protocol (e.g. if `link url` is a path to a file). We may wish to change this in the future to only linkify when the URL has a valid protocol scheme, but for now we delegate handling this to the terminal emulator. In order to support directives which reference other nodes, the highlighter must be updated to use `iter_matches` rather than `iter_captures`. The former provides the `match` table which maps capture IDs to nodes. However, this has its own challenges: - `iter_matches` does not guarantee the order in which patterns are iterated matches the order in the query file. So we must enforce ordering manually using "subpriorities" (#27131). The pattern index of each match dictates the extmark's subpriority. - When injections are used, the highlighter contains multiple trees. The pattern indices of each tree must be offset relative to the maximum pattern index from all previous trees to ensure that extmarks appear in the correct order. - The `iter_captures` implementation currently has a bug where the "match" table is only returned for the first capture within a pattern (see #27274). This bug means that `#set!` directives in a query apply only to the first capture within a pattern. Unfortunately, many queries in the wild have come to depend on this behavior. `iter_matches` does not share this flaw, so switching to `iter_matches` exposed bugs in existing highlight queries. These queries have been updated in this repo, but may still need to be updated by users. The `#set!` directive applies to the _entire_ query pattern when used without a capture argument. To make `#set!` apply only to a single capture, the capture must be given as an argument.
* | fix: move fswatch linux check inside of vim.schedule (#27824)Tomas Slusny2024-03-12
| | | | | | | | | | | | Fixes issue reported in the original PR: https://github.com/neovim/neovim/pull/27810 Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
* | refactor: avoid quadratic behavior in backslash_halve() (#27827)James2024-03-12
| | | | | | | | | | | | | | | | | | | | | | The original implementation has a worst-case of O(n^2). Every time rem_backslash() is true, it calculates the length of the rest of the string, and shift the rest of it to the left; backslash_halve_save() copies the original string before doing backslash_halve(). The new implementation is O(n). It will find the first character where rem_backslash() is true (it will do nothing if it's always false), and shift the characters in-place; backslash_halve_save() avoids copying the original string before doing backslash_halve().
* | docs: small fixes (#27364)dundargoc2024-03-12
| | | | | | | | | | | | | | | | Co-authored-by: C.D. MacEachern <craig.daniel.maceachern@gmail.com> Co-authored-by: Ynda Jas <yndajas@gmail.com> Co-authored-by: Owen Hines <TheOdd@users.noreply.github.com> Co-authored-by: Wanten <41904684+WantenMN@users.noreply.github.com> Co-authored-by: lukasvrenner <118417051+lukasvrenner@users.noreply.github.com> Co-authored-by: cuinix <915115094@qq.com>
* | refactor: use ml_get_buf_len() in API code (#27825)zeertzjq2024-03-12
| |
* | vim-patch:9.1.0168: too many STRLEN() calls (#27823)zeertzjq2024-03-12
| | | | | | | | | | | | | | | | | | | | | | Problem: too many STRLEN() calls Solution: Make use of ml_get_len() calls instead (John Marriott) closes: vim/vim#14123 https://github.com/vim/vim/commit/bfcc895482c717c9f6d86890d789ec739c3016b4 Co-authored-by: John Marriott <basilisk@internode.on.net>
* | vim-patch:5cd86c6cff94 (#27822)zeertzjq2024-03-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | runtime(vim): Update base-syntax, improve number matching (vim/vim#14175) - Limit blob literals to an even number of hexadecimal digits and correctly located dots. - Match octal numbers. The current version unsuccessfully attempts to match a leading '-' as part of the float literal. It's actually parsed as part of the literal for all numbers but the syntax file hasn't matched it like that for a long time and highlights negative numbers as UNARY-MINUS NUMBER. This will be fixed when better expression matching is implemented. https://github.com/vim/vim/commit/5cd86c6cff94256ed2db872c46b57da259a648ac Co-authored-by: dkearns <dougkearns@gmail.com>
* | vim-patch:9.1.0167: Changing buffer in another window causes it to show ↵zeertzjq2024-03-12
| | | | | | | | | | | | | | | | | | | | | | | | matchparen (#27820) Problem: Changing buffer in another window using win_execute() causes it to show matchparen (after 9.0.0969). Solution: Delay highlighting with SafeState in BufWinEnter. (zeertzjq) closes: vim/vim#14177 https://github.com/vim/vim/commit/49ffb6b428e1e053446ec0209558a8f9d0963ae7
* | vim-patch:9.1.0166: Internal error with blockwise getregion() in another ↵zeertzjq2024-03-12
| | | | | | | | | | | | | | | | | | | | buffer (#27819) Problem: Internal error with blockwise getregion() in another buffer Solution: Also change curwin->w_buffer when changing curbuf (zeertzjq) closes: vim/vim#14179 https://github.com/vim/vim/commit/5406eb8722bddb6a04876956f9a53c1752994851
* | vim-patch:8.2.4944: text properties are wrong after "cc" (#27821)zeertzjq2024-03-12
| | | | | | | | | | | | | | | | | | Problem: Text properties are wrong after "cc". (Axel Forsman) Solution: Pass the deleted byte count to inserted_bytes(). (closes vim/vim#10412, closes vim/vim#7737, closes vim/vim#5763) https://github.com/vim/vim/commit/d0b1a09f44654bb5e29b09de1311845200f17d90 Co-authored-by: LemonBoy <thatlemon@gmail.com>
* | vim-patch:0049a495c8d4 (#27817)zeertzjq2024-03-12
| | | | | | | | | | | | | | | | runtime(doc): improve 'winfixbuf' docs (vim/vim#14180) - Make it not sound like a buffer option. - "!" is called a modifier, not an option. https://github.com/vim/vim/commit/0049a495c8d4a597773587f622d8cc8573c2eb75
* | Merge pull request #27812 from luukvbaal/cmdheightbfredl2024-03-11
|\ \ | | | | | | feat(ui): allow non-zero 'cmdheight' with ext_messages
| * | feat(ui): allow non-zero 'cmdheight' with ext_messagesLuuk van Baal2024-03-11
| | | | | | | | | | | | | | | | | | | | | Problem: Arbitrary restriction on 'cmdheight' with ext_messages. The 'cmdheight'-area may be desirable for the replacing cmdline. Solution: Allow non-zero 'cmdheight' with ext_messages.
* | | test: correct order of arguments to eq() (#27816)zeertzjq2024-03-11
| | |
* | | docs: adjust fswatch overflow message to mention docs with infoTomas Slusny2024-03-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | - Add :h fswatch-limitations that notifies user about default inotify limitations on linux and how to adjust them - Check for Event queue overflow message from fswatch and refer user to new documentation Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
* | | fix(editorconfig): syntax error regressionLewis Russell2024-03-11
| | |
* | | build(deps): bump luajit to HEAD - d06beb048Christian Clason2024-03-11
|/ /
* | Merge pull request #27738 from ColinKennedy/vim-9.1.0147zeertzjq2024-03-11
|\ \ | | | | | | vim-patch:9.1.{0147,0149,0150,0152,0156},58f1e5c0893a: 'winfixbuf'
| * | vim-patch:9.1.0156: Make 'wfb' failing to split still report E1513zeertzjq2024-03-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: may not be clear why failing to split causes an ":Xdo" command to abort if 'wfb' is set. Solution: do not return immediately if win_split fails, so E1513 is still given. Expect both errors in the test. Also fix tests to pass CI. (Sean Dewar) closes: vim/vim#14152 https://github.com/vim/vim/commit/769eb2d0c3614f9ea6fffa82329558f1a4af384f Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
| * | vim-patch:9.1.0152: Coverity complains about ignoring return valuezeertzjq2024-03-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Coverity complains about ignoring return value of win_split() (after v9.1.150) Solution: Check if win_split() failed, add winfixbuf.res to Makefile https://github.com/vim/vim/commit/af7ae8160041e2d17c56945381e9370e7178e596 Co-authored-by: Christian Brabandt <cb@256bit.org>
| * | vim-patch:9.1.0150: Several minor 'winfixbuf' issuesColin Kennedy2024-03-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: several minor 'winfixbuf' issues exist, mostly relating to the quickfix list Solution: address them and adjust tests. Retab and reflow a few things too. (Sean Dewar) Things touched include: - Replace the semsgs with gettext'd emsgs. - Handle window switching in ex_listdo properly, so curbuf and curwin are kept in-sync and trigger autocommands; handle those properly. - Don't change the list entry index in qf_jump_edit_buffer if we fail due to 'wfb' (achieved by returning FAIL; QF_ABORT should only be used if the list was changed). - Make qf_jump_edit_buffer actually switch to prevwin when using `:cXX` commands **outside** of the list window if 'wfb' is set in curwin. Handle autocommands properly in case they mess with the list. NOTE: previously, it seemed to split if 'wfb' was set, but do nothing and fail if prevwin is *valid*. This behaviour seemed strange, and maybe unintentional? Now it aligns more with what's described for the `:cXX` commands in the original PR description when used outside a list window, I think. - In both functions, only consider prevwin if 'wfb' isn't set for it; fallback to splitting otherwise. - Use win_split to split. Not sure if there was a specific reason for using ex_splitview. win_split is simpler and respects modifiers like :vertical that may have been used. Plus, its return value can be checked for setting opened_window in qf code (technically win_split_ins autocmds could immediately close it or change windows, in which the qf code might close some other window on failure; it's already the case elsewhere, though). closes: vim/vim#14142 https://github.com/vim/vim/commit/4bb505e28cac0389561fff78d8bbe0319c2bcf2f Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
| * | vim-patch:9.1.0149: null pointer member access when accessing 'winfixbuf' ↵Colin Kennedy2024-03-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | property Problem: qf_goto_win_with_qfl_file may check if prevwin has 'winfixbuf' set without checking if it's valid first. Solution: Reverse the condition. Add a test, a modeline, and a missing CheckFeature. (Searn Dewar) closes: vim/vim#14140 https://github.com/vim/vim/commit/5131f224da93f2e042a4b22545ef62b1b2ab8460 Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
| * | vim-patch:9.1.0147: Cannot keep a buffer focused in a windowColin Kennedy2024-03-11
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Cannot keep a buffer focused in a window (Amit Levy) Solution: Add the 'winfixbuf' window-local option (Colin Kennedy) fixes: vim/vim#6445 closes: vim/vim#13903 https://github.com/vim/vim/commit/215703563757a4464907ead6fb9edaeb7f430bea N/A patch: vim-patch:58f1e5c0893a
* | docs(editorconfig): move to sourceLewis Russell2024-03-10
| |
* | docs: more accurate typing for vim.tbl_extendRiley Bruins2024-03-10
| |
* | vim-patch:675cbfb47f03 (#27806)zeertzjq2024-03-11
| | | | | | | | | | | | | | | | | | runtime(doc): Update Markdown syntax, add missing configs fixes: vim/vim#14168 https://github.com/vim/vim/commit/675cbfb47f03c65b2a5c245b632bdd7a0bf10e4f Co-authored-by: Christian Brabandt <cb@256bit.org>
* | vim-patch:9.1.0164: Internal error when passing invalid position to ↵zeertzjq2024-03-11
| | | | | | | | | | | | | | | | | | | | | | getregion() (#27805) Problem: Internal error or crash when passing invalid position to getregion(). Solution: Give an error for invalid position (zeertzjq). closes: vim/vim#14172 https://github.com/vim/vim/commit/26dd09ad5e86f4e2179be0181421bfab9a6b3b75
* | fix(fswatch): --latency is locale dependentOscar Creator2024-03-10
|/
* vim-patch:9.1.0138: too many STRLEN calls when getting a memline (#27799)zeertzjq2024-03-10
| | | | | | | | | | | | | | | | Problem: too many STRLEN calls when getting a memline Solution: Optimize calls to STRLEN(), add a few functions in memline.c that return the byte length instead of relying on STRLEN() (John Marriott) closes: vim/vim#14052 https://github.com/vim/vim/commit/02d7a6c6cfceb3faf9c98fcb7c458760cd50d269 Cherry-pick line break changes from patch 8.1.0226. Cherry-pick ml_line_len from patch 8.1.0579. Cherry-pick test_comments.vim change from patch 9.1.0153. Co-authored-by: John Marriott <basilisk@internode.on.net>
* vim-patch:9.1.0162: problem with writing extended attributes on failure (#27800)zeertzjq2024-03-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: problem with writing extended attributes on failure Solution: Change return type to ssize_t and check listxattr's return value correctly on failure (Paul Tagliamonte) The existing logic will return when the listxattr call returns with the errno set to ENOTSUP (or a size of 0 bytes), without checking to see if listxattr actually failed. listxattr can fail with at least E2BIG, ENOTSUP, ERANGE, or anything that `stat(2)` can fail with (in my case; ENOENT from stat). The returned size is stored to a size_t, but the return type is a ssize_t. On failure, listxattr returns -1, which will get translated to size_t's MAX. If the listxattr call failed with anything other than ENOTSUP, this triggers a request for size_t MAX bytes. This means that, if the listxattr call fails with anything other than ENOTSUP on save, vim will error with `E342: Out of memory! (allocating 18446744073709551615 bytes)` (keen observers will note 18446744073709551615 is 0xffffffffffffffff) In reality, this is likely masking a different (usually filesystem?) error -- but at least it's an error being pushed to the user now, and we don't try to allocate size_t MAX bytes. I've opted to change the type that we store listxattr to from size_t to ssize_t, to match listxattr(2)'s signature, and to check for the -1 return value. Additionally, I've removed the errno check -- if we get a listxattr failure for any reason, we may as well bail without trying; it's not like we can even recover. closes: vim/vim#14169 https://github.com/vim/vim/commit/14759ded57447345ba11c11a99fd84344797862c Co-authored-by: Paul R. Tagliamonte <paultag@gmail.com>
* Merge pull request #27798 from zeertzjq/vim-62b26040eb4bzeertzjq2024-03-10
|\ | | | | vim-patch: update Vim syntax
| * vim-patch:5d67aef3060dzeertzjq2024-03-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | runtime(vim): Update base-syntax, improve :map highlighting (vim/vim#14141) Improve :map command highlighting. - Fix multiline RHS matching, allow continued lines and comments. - Allow ^V-escaped whitespace in LHS. - Handle map-bar properly and allow trailing commands. Fixes issue vim/vim#12672. https://github.com/vim/vim/commit/5d67aef3060d6d3aa14d273c39f23d8a90c4cef1 Co-authored-by: dkearns <dougkearns@gmail.com>
| * vim-patch:62b26040eb4bzeertzjq2024-03-10
|/ | | | | | | | | | | | | | | | runtime(vim): Update base-syntax, improve :menu{,translate} highlighting (vim/vim#14162) Improve :menu and :menutranslate highlighting. - Match args to :menutranslation and :popup. - Only highlight special notation in {rhs} of :menu, like :map. - Allow line continuations in {rhs} of :menu and between {english} and {mylang} of :menutranslation, matching common usage. - Bug fixes. https://github.com/vim/vim/commit/62b26040eb4b6752be2c46852e8986083737a1bb Co-authored-by: dkearns <dougkearns@gmail.com>
* vim-patch:a2c65809dafeChristian Clason2024-03-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | runtime(java): Recognise string templates (vim/vim#14150) As this is encouraged in the referenced JEPs, "to visually distinguish a string template from a string literal, and a text block template from a text block", the default colours for java\%[Debug]StrTempl are made distinct from java\%[Debug]String. According to §3.2 Lexical Translations (JLS, c. 1996 or any more recent version), line terminators, white space, and comments are discarded before tokens are accepted. Since a template expression comprises a template processor, a dot, and a template, it may be visually appealing to break up its head across a few lines whenever its tail already spans multiple lines. Curiously, no allowance for it is made in the distributed tests for OpenJDK 21; the proposed regexp patterns take in consideration a line terminator and white space after a dot. References: https://openjdk.org/jeps/430 (Preview) https://openjdk.org/jeps/459 (Second Preview) https://openjdk.org/jeps/465 https://github.com/vim/vim/commit/a2c65809dafe5c4f45f278fddf368c7c971d83e9 Co-authored-by: Aliaksei Budavei <32549825+zzzyxwvut@users.noreply.github.com>
* revert: "fix(window): :close crash with autocmd, floats and tabpage" (#27796)zeertzjq2024-03-10
| | | | | | | | This reverts PR #27793. On second thought, this solution may still crash, because it can leave a window with a NULL buffer if there are autocommand windows or if closing a floating window fails. It also makes close_last_window_tabpage() more complicated, so revert it.
* fix(window): :close crash if WinClosed from float closes window (#27794)zeertzjq2024-03-10
| | | | Problem: :close crash if WinClosed from float closes window. Solution: Check if window has already been closed.
* fix(window): :close crash with autocmd, floats and tabpage (#27793)zeertzjq2024-03-10
| | | | Problem: :close crash with autocmd, floats and tabpage. Solution: Close floating windows in one more case.
* vim-patch:9.1.0159: Crash in WinClosed after BufUnload closes other windows ↵zeertzjq2024-03-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | (#27792) Problem: Crash in WinClosed after BufUnload closes other windows Solution: Don't trigger WinClosed if the buffer is NULL (zeertzjq) Now win_close_othertab() doesn't trigger any autocommands if the buffer is NULL, so remove the autocmd blocking above (which was added not long ago in patch v9.0.0550) for consistency. Also remove an unreachable close_last_window_tabpage() above: - It is only reached if only_one_window() returns TRUE and last_window() returns FALSE. - If only_one_window() returns TRUE, there is only one tabpage. - If there is only one tabpage and last_window() returns FALSE, the one_window() in last_window() must return FALSE, and the ONE_WINDOW in close_last_window_tabpage() must also be FALSE. - So close_last_window_tabpage() doesn't do anything and returns FALSE. Then the curtab != prev_curtab check also doesn't make much sense, and the only_one_window() can be replaced with a check for popup and a call to last_window() since this is a stricter check than only_one_window(). closes: vim/vim#14166 https://github.com/vim/vim/commit/b2ec0da080fb24f12a8d6f54bd7318a078ca4e6c
* vim-patch:9.1.0161: expand() removes slash after env variable that ends with ↵zeertzjq2024-03-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | colon (#27791) Problem: expand() removes a slash after an environment variable that ends with a colon on Windows. Solution: Check the correct char for a colon (zeertzjq) closes: vim/vim#14161 Note: Vim still removes the path-separator at the end, if another path separator follows directly after it, e.g. on: ``` echo $FOO='/usr/' echo expand('$FOO/bar') == '/usr/bar' ``` see: ,----[ misc1.c:1630 ] | // if var[] ends in a path separator and tail[] starts | // with it, skip a character | if (after_pathsep(dst, dst + c) | #if defined(BACKSLASH_IN_FILENAME) || defined(AMIGA) | && (dst == save_dst || dst[-1] != ':') | #endif | && vim_ispathsep(*tail)) | ++tail; `---- https://github.com/vim/vim/commit/13a014452a7a020a119ac555a690c65b41f3126d Cherry-pick test_expand.vim change from patch 9.0.1257.
* Merge pull request #27330 from seandewar/win_set_config-fixesSean Dewar2024-03-09
|\ | | | | | | | | fix(api): various window-related function fixes This is a big one!
| * vim-patch:8.2.3862: crash on exit with EXITFREE and using win_execute()Sean Dewar2024-03-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Crash on exit with EXITFREE and using win_execute(). Solution: Also save and restore tp_topframe. (issue vim/vim#9374) https://github.com/vim/vim/commit/dab17a0689a2f31f69f428975f84b0c3c7ba3030 Couldn't repro the crash in the test, but I only care about this patch so switch_win sets topframe properly for win_split_ins in nvim_open_win and nvim_win_set_config. Add a test using nvim_win_call and :wincmd, as I couldn't repro the issue via nvim_open_win or nvim_win_set_config (though it's clear they're affected by this patch). That said, at that point, could just use {un}use_tabpage inside switch_win instead, which also updates tp_curwin (though maybe continue to not set it in restore_win). That would also fix possible inconsistent behaviour such as: :call win_execute(w, "let curwin_nr1 = tabpagewinnr(1)") :let curwin_nr2 = tabpagewinnr(1) Where it's possible for curwin_nr1 != curwin_nr2 if these commands are run from the 1st tabpage, but window "w" is in the 2nd (as the 1st tabpage's tp_curwin may still be invalid). I'll probably PR a fix for that later in Vim. Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * fix(api): win_set_config set tp_curwin of win moved from other tabpageSean Dewar2024-03-09
| | | | | | | | | | | | | | Problem: nvim_win_set_config does not update the tp_curwin of win's original tabpage when moving it to another. Solution: update it if win was the tp_curwin. Add a test.
| * fix(window): :close may cause Nvim to quit with autocmd and floatzeertzjq2024-03-09
| | | | | | | | | | | | | | Problem: :close may cause Nvim to quit if an autocommand triggered when closing the buffer closes all other non-floating windows and there are floating windows. Solution: Correct the check for the only non-floating window.
| * test(old): remove Test_floatwin_splitmove()zeertzjq2024-03-09
| | | | | | | | | | | | Its corresponding test in Vim is in test_popupwin.win, so having it in the middle of test_window_cmd.vim is strange, and it is now covered by tests in ui/float_spec.lua anyway.
| * fix(api): win_set_config update statuslines after removing splitsSean Dewar2024-03-09
| | | | | | | | | | | | | | | | | | | | | | | | | | Problem: nvim_win_set_config does not update statuslines after removing a split. Solution: call last_status. Didn't realize this was missing in the original nvim_win_set_config for splits PR. As it can only be done for the current tabpage, do it if win_tp == curtab; enter_tabpage will eventually call last_status anyway when the user enters another tabpage.
| * fix(api): patch some cmdwin/textlock holesSean Dewar2024-03-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: there are new ways to escape textlock or break the cmdwin in nvim_win_set_config and nvim_tabpage_set_win. Solution: fix them. Use win_goto to check it in nvim_tabpage_set_win and use the try_start/end pattern like with similar functions such as nvim_set_current_win (which uses the existing msg_list, if set). Careful not to use `wp->handle` when printing the window ID in the error message for nvim_tabpage_set_win, as win_goto autocommands may have freed the window. On a related note, I have a feeling some API functions ought to be checking curbuf_locked...
| * fix(api): handle win_split_ins failure properlySean Dewar2024-03-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: nvim_win_set_config does not handle failure in win_split_ins properly yet, which can cause all sorts of issues. Also nvim_open_win and nvim_win_set_config do not set the error message to the one from win_split_ins. Solution: handle failure by undoing winframe_remove, like in win_splitmove. Make sure autocommands from switching to the altwin fire within a valid window, and ensure they don't screw things up. Set the error message to that of win_split_ins, if any. Also change a few other small things, including: - adjust win_append to take a tabpage_T * argument, which is more consistent with win_remove (and also allows us to undo a call to win_remove). - allow winframe_restore to restore window positions. Useful if `wp` was in a different tabpage, as a call to win_comp_pos (which only works for the current tabpage) after winframe_restore should no longer be needed. Though enter_tabpage calls win_comp_pos anyway, this has the advantage of ensuring w_winrow/col remains accurate even before entering the tabpage (useful for stuff like win_screenpos, if used on a window in another tabpage). (This change should probably also be PR'd to Vim later, even though it doesn't use winframe_restore for a `wp` in a different tabpage yet).