Commit Graph

6670 Commits

Author SHA1 Message Date
zeertzjq
0bca5bff53 vim-patch:8.2.3026: Vim9: cannot set breakpoint in compiled function
Problem:    Vim9: cannot set breakpoint in compiled function.
Solution:   Check for breakpoint when calling a function.

4f8f54280f

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-11-13 06:46:17 +08:00
zeertzjq
940d9c59a7 vim-patch:8.2.3017: Vim9: debugger shows too many lines
Problem:    Vim9: debugger shows too many lines.
Solution:   Truncate at a comment, "enddef", etc. (closes vim/vim#8392)

59b50c3bee

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-11-13 06:46:17 +08:00
zeertzjq
02a43ddf1e vim-patch:8.2.3013: Vim: when debugging only first line of command is displayed
Problem:    Vim: when debugging only the first line of a command using line
            continuation is displayed.
Solution:   Find the next command and concatenate lines until that one.
            (closes vim/vim#8392)

4cea536bdf

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-11-13 06:46:17 +08:00
zeertzjq
d46b6b2978 vim-patch:8.2.3011: Vim9: cannot get argument values during debugging
Problem:    Vim9: cannot get argument values during debugging.
Solution:   Lookup names in the list of arguments.  Put debug instruction
            halfway for command.

6bc30b05e6

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-11-13 06:46:17 +08:00
zeertzjq
3e8541f4a0 vim-patch:8.2.3003: Vim9: closure compiled with wrong compile type
Problem:    Vim9: closure compiled with wrong compile type.
Solution:   Use COMPILE_TYPE() when calling a function. (closes vim/vim#8384)

968a5b62ff

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-11-13 06:46:17 +08:00
zeertzjq
04d951685b vim-patch:8.2.2996: Vim9: when debugging cannot inspect local variables
Problem:    Vim9: when debugging cannot inspect local variables.
Solution:   Make local variables available when debugging.

b69c6fb7b4

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-11-13 06:46:17 +08:00
zeertzjq
5ce3b89ff3 vim-patch:8.2.2985: Vim9: a compiled function cannot be debugged
Problem:    Vim9: a compiled function cannot be debugged.
Solution:   Add initial debugging support.

e99d422bbd

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-11-13 06:46:17 +08:00
zeertzjq
74e23b3b2a
vim-patch:2dd613f57bf1 (#26009)
runtime(termdebug): improve the breakpoint sign label (vim/vim#13525)

// related vim/vim#12589
// that should be the last chat (I) with Bram, r.i.p

2dd613f57b

Co-authored-by: Shane-XB-Qian <shane.qian@foxmail.com>
2023-11-13 05:44:30 +08:00
dundargoc
353a4be7e8 build: remove PVS
We already have an extensive suite of static analysis tools we use,
which causes a fair bit of redundancy as we get duplicate warnings. PVS
is also prone to give false warnings which creates a lot of work to
identify and disable.
2023-11-12 21:26:39 +01:00
LW
448907f65d
feat(lsp)!: vim.lsp.inlay_hint.get(), enable(), is_enabled() #25512
refactor!: `vim.lsp.inlay_hint()` -> `vim.lsp.inlay_hint.enable()`

Problem:
The LSP specification allows inlay hints to include tooltips, clickable
label parts, and code actions; but Neovim provides no API to query for
these.

Solution:
Add minimal viable extension point from which plugins can query for
inlay hints in a range, in order to build functionality on top of.

Possible Next Steps
---

- Add `virt_text_idx` field to `vim.fn.getmousepos()` return value, for
  usage in mappings of `<LeftMouse>`, `<C-LeftMouse>`, etc
2023-11-12 04:54:27 -08:00
zeertzjq
ad3568a701
vim-patch:9.0.2101: CI: test_termdebug may still fail (#26003)
Problem:  CI: test_termdebug may still fail
Solution: use term_wait() to make it more robust

closes: vim/vim#13529

fdbadea4b6

Co-authored-by: shane.xb.qian <shane.qian@foxmail.com>
2023-11-12 18:18:28 +08:00
zeertzjq
9ecb43b637
fix(float): apply 'winblend' to title/footer highlight (#25999) 2023-11-12 09:23:34 +08:00
zeertzjq
145d9ed0fc
vim-patch:9.0.2100: CI: test_termdebug fails (#25997)
Problem:  CI: test_termdebug fails
Solution: only test for a changed winlayout, if the window
          width actually changed

Also, include an unrelated comment (which doesn't warrant its own patch
number)

305127f9f2

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-11-12 08:18:40 +08:00
ObserverOfTime
c23dd7c9ef
vim-patch:9.0.2098: No filetype support for xcompose files (#25983)
Problem:  No filetype support for xcompose files
Solution: Add filetype detection

closes: vim/vim#13508

4f9074b96c
2023-11-12 07:51:25 +08:00
Christian Clason
84688ec372 vim-patch:9.0.2097: No support for cypher files
Problem:  No support for cypher files
Solution: Add cypher filetype detection

Cypher query language support to work with (mostly) graph databases.

Already existing lsp support in Neovim's nvim-lspconfig:
https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#cypher_ls

closes: vim/vim#13516

8f0fe20ff1

Co-authored-by: Gerrit Meier <meistermeier@gmail.com>
2023-11-12 00:22:28 +01:00
zeertzjq
6c3e170e56
fix(highlight): apply 'winblend' to float border (#25981) 2023-11-11 15:12:58 +08:00
zeertzjq
fdaf6bc557
fix(context): don't leak memory on multiple invalid objects (#25979) 2023-11-11 13:10:26 +08:00
zeertzjq
e9b9a86cd5
fix(context): don't crash on invalid arg to nvim_get_context (#25977)
Note: The crash happens in the second test case when using uninitialized
memory, and therefore doesn't happen with ASAN.
2023-11-11 10:21:14 +08:00
mortezadadgar
d1b2a5cf5f
fix(completion): make sure the buffer name is valid (#25975)
Problem:
crash from
  set complete+=f
  open a empty buffer
  C-N

Solution:
make sure the buffer name is valid.

regression from ae4ca4edf8
2023-11-11 06:41:10 +08:00
dundargoc
4e33ef747c test: skip failing test on freebsd
The watch_file test started failing on bsd after
3ca967387c.
2023-11-10 21:10:15 +01:00
zeertzjq
d5a85d737a
fix(f_wait): flush UI before blocking (#25962) 2023-11-10 15:24:36 +08:00
zeertzjq
bf5cf8ae82
vim-patch:8.2.4078: terminal test for current directory not used on FreeBSD (#25961)
Problem:    Terminal test for current directory not used on FreeBSD.
Solution:   Make it work on FreeBSD. (Ozaki Kiichi, closes vim/vim#9516) Add
            TermWait() inside Run_shell_in_terminal() as a generic solution.

ced2b38a56

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-11-10 14:20:32 +08:00
Omar El Halabi
9af03bcd47
fix(options): do not change inccommand during preview (#25462) 2023-11-09 22:20:26 -06:00
zeertzjq
04d299c170 vim-patch:8.2.4932: not easy to filter the output of maplist()
Problem:    Not easy to filter the output of maplist().
Solution:   Add mode_bits to the dictionary. (Ernie Rael, closes vim/vim#10356)

d8f5f76621

Co-authored-by: Ernie Rael <errael@raelity.com>
2023-11-09 21:34:04 +08:00
zeertzjq
f748a73a35 vim-patch:8.2.4861: it is not easy to restore saved mappings
Problem:    It is not easy to restore saved mappings.
Solution:   Make mapset() accept a dict argument. (Ernie Rael, closes vim/vim#10295)

51d04d16f2

Co-authored-by: Ernie Rael <errael@raelity.com>
2023-11-09 21:34:04 +08:00
zeertzjq
d4dbfb092b vim-patch:8.2.4825: can only get a list of mappings
Problem:    Can only get a list of mappings.
Solution:   Add the optional {abbr} argument. (Ernie Rael, closes vim/vim#10277)
            Rename to maplist().  Rename test file.

09661203ec

Co-authored-by: Ernie Rael <errael@raelity.com>
2023-11-09 21:34:04 +08:00
zeertzjq
2dfcd5a22b vim-patch:8.2.4820: not simple programmatic way to find a specific mapping
Problem:    Not simple programmatic way to find a specific mapping.
Solution:   Add getmappings(). (Ernie Rael, closes vim/vim#10273)

659c240cf7

Co-authored-by: Ernie Rael <errael@raelity.com>
2023-11-09 21:34:04 +08:00
zeertzjq
a4b80c71ea vim-patch:8.2.4140: maparg() does not indicate the type of script
Problem:    maparg() does not indicate the type of script where it was defined.
Solution:   Add "scriptversion".

a9528b39a6

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-11-09 21:34:02 +08:00
zeertzjq
43b0e2752c
refactor(api): simplify nvim_set_keymap shortname check (#25945) 2023-11-09 12:28:43 +08:00
zeertzjq
77bb69d7b0
vim-patch:7fbbd7fdc6df (#25944)
runtime(termdebug):  handle buffer-local mappings properly

closes: vim/vim#13475

7fbbd7fdc6

Co-authored-by: shane.xb.qian <shane.qian@foxmail.com>
2023-11-09 08:38:25 +08:00
zeertzjq
89d785e530 vim-patch:ca48202b6f46
runtime(termdebug): improve window handling, shorten var types

closes vim/vim#13474

ca48202b6f

Co-authored-by: shane.xb.qian <shane.qian@foxmail.com>
2023-11-09 07:24:31 +08:00
zeertzjq
7b921c5501 vim-patch:9.0.1811: still some issues with term_debug test
Problem:  still some issues with term_debug test
Solution: Use WaitForAssert()

closes: vim/vim#12936

85c3a5bc26

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-11-09 07:05:21 +08:00
zeertzjq
4d36892191 vim-patch:9.0.1809: termdebug test flayk
Problem:  termdebug test flayk
Solution: wait slightly longer

6c93c94929

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-11-09 07:05:21 +08:00
zeertzjq
c9e7e94fcc vim-patch:9.0.1808: termdebug: Typo in termdebug test
Problem:  termdebug: Typo in termdebug test
Solution: fix the typos

f2534434c9

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-11-09 07:05:21 +08:00
zeertzjq
8d3dbf2746 vim-patch:9.0.1791: No tests for the termdebug plugin
Problem:  No tests for the termdebug plugin
Solution: Add some simple tests for the termdebug plugin

closes: vim/vim#12927

58f39d89a8

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-11-09 07:05:21 +08:00
zeertzjq
f7b2ea59a6
vim-patch:9.0.2095: statusline may look different than expected (#25941)
Problem:  statusline may look different than expected
Solution: do not check for highlighting of stl and stlnc characters

statusline fillchar may be different than expected

If the highlighting group for the statusline for the current window
|hl-StatusLine| or the non-current window |hl-StatusLineNC| are cleared
(or do not differ from each other), than Vim will use the hard-coded
fallback values '^' (for the non-current windows) or '=' (for the
current window).  I believe this was done, to make sure the statusline
will always be visible and be distinguishable from the rest of the
window.

However, this may be unexpected, if a user explicitly defined those
fillchar characters just to notice that those values are then not used
by Vim.

So, let's assume users know what they are doing and just always return
the configured stl and stlnc values.  And if they want the statusline to
be non-distinguishable from the rest of the window space, so be it.  It
is their responsibility and Vim shall not know better what to use.

fixes: vim/vim#13366
closes: vim/vim#13488

6a650bf696

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-11-09 06:34:34 +08:00
bfredl
1b0fd377ab
Merge pull request #25767 from luukvbaal/signdel
feat(extmarks): add 'invalidate' property
2023-11-08 12:17:25 +01:00
Luuk van Baal
4e6f559b8c feat(extmarks): add 'invalidate' property to extmarks
Problem:  No way to have extmarks automatically removed when the range it
          is attached to is deleted.
Solution: Add new 'invalidate' property that will hide a mark when the
          entirety of its range is deleted. When "undo_restore" is set
          to false, delete the mark from the buffer instead.
2023-11-08 02:53:49 +01:00
zeertzjq
1c71c32b29
fix(job-control): make jobwait() flush UI after hiding cursor (#25927) 2023-11-08 06:29:58 +08:00
zeertzjq
a935c7531a
test(ui/decorations_spec): avoid flakiness caused by undo msg (#25924) 2023-11-07 11:09:50 +08:00
altermo
3198038224
fix(lua): correct return value for on_key with no arguments (#25911) 2023-11-07 08:33:38 +08:00
Christian Clason
324fad1e88 vim-patch:9.0.2092: tests: failure in test_arabic
Problem:  tests: failure in test_arabic
Solution: adjust the test for the changed arabic keymap

2a94e98792

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-11-05 21:56:56 +01:00
bfredl
68cb4a7405 feat(extmarks): add "undo_restore" flag to opt out of undo-restoring
It is a design goal of extmarks that they allow precise tracking
of changes across undo/redo, including restore the exact positions
after a do/undo or undo/redo cycle. However this behavior is not useful
for all usecases. Many plugins won't keep marks around for long after
text changes, but uses them more like a cache until some external source
(like LSP semantic highlights) has fully updated to changed text and
then will explicitly readjust/replace extmarks as needed.

Add a "undo_restore" flag which is true by default (matches existing
behavior) but can be set to false to opt-out of this behavior.

Delete dead u_extmark_set() code.
2023-11-05 12:18:29 +01:00
zeertzjq
ec66a95fbc
vim-patch:9.0.2090: complete_info() skips entries with 'noselect' (#25890)
Problem:  complete_info() skips entries with 'noselect'
Solution: Check, if first entry is at original text state

Unfortunately, Commit daef8c74375141974d61b85199b383017644978c
introduced a regression, that when ':set completeopt+=noselect' is set
and no completion item has been selected yet, it did not fill the
complete_info['items'] list.

This happened, because the current match item did not have the
CP_ORIGINAL_TEXT flag set and then the cp->prev pointer did point to the
original flag item, which caused the following while loop to not being
run but being skipped instead.

So when the 'noselect' is set, only start with to the previous selection
item, if the initial completion item has the CP_ORIGINAL_TEXT flag set,
else use the 2nd previous item instead.

fixes: vim/vim#13451
closes: vim/vim#13452

57f9ce1a09

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-11-04 21:59:03 +08:00
LW
468292dcb7
fix(rpc): "grid_line" event parsing crashes (#25581)
refactor: use a more idiomatic loop to iterate over the cells

There are two cases in which the following assertion would fail:
```c
assert(g->icell < g->ncells);
```

1. If `g->ncells = 0`. Update this to be legal.
2. If an EOF is reached while parsing `wrap`. In this case, the unpacker
   attempts to resume from `cells`, which is a bug. Create a new state
   for parsing `wrap`.

Reference: https://neovim.io/doc/user/ui.html#ui-event-grid_line
2023-11-04 06:56:45 +08:00
bfredl
44f0480a22 refactor(grid): implement rightleftcmd as a post-processing step
Previously, 'rightleftcmd' was implemented by having all code which
would affect msg_col or output screen cells be conditional on `cmdmsg_rl`.
This change removes all that and instead implements rightleft as a
mirroring post-processing step.
2023-11-03 11:35:42 +01:00
zeertzjq
4c32927084
test(ui/embed_spec): make sure server is started (#25880) 2023-11-03 08:19:04 +08:00
zeertzjq
d7359a8742
fix(startup): trigger UIEnter for the correct channel (#25860) 2023-11-01 12:16:37 +08:00
George Harker
4e6096a67f
feat(server): allow embed with listen (#25709)
connection from any channel or stdio will unblock
remote_ui_wait_for_attach.  Wait on stdio only if
only —embed specified, if both —embed and
—listen then wait on any channel.
2023-11-01 11:04:53 +08:00
Gregory Anders
224f303ee5
feat(stdlib): add vim.base64 module (#25843)
Add base64 encode() and decode() functions to a vim.base64 module.
2023-10-31 09:15:32 -05:00
zeertzjq
d4c2fc6ff6
fix(terminal): keep focus when scrolling number column of another window (#25848) 2023-10-31 15:23:20 +08:00
zeertzjq
c881092ffe
fix(terminal): don't lose focus on <MouseMove> (#25845) 2023-10-31 12:05:37 +08:00
bfredl
6d1a2f2c3c
Merge pull request #25674 from famiu/refactor/options/unify_string_options
refactor(options): unify `set_option` and `set_string_option`
2023-10-30 20:06:57 +01:00
Famiu Haque
e19cc9c9b7 refactor(options)!: unify set_option and set_string_option
While the interfaces for setting number and boolean options are now unified by #25394, there is still a separate `set_string_option` function that is used for setting a string option. This PR removes that function and merges it with set_option.

BREAKING CHANGE: `v:option_old` is now the old global value for all global-local options, instead of just string global-local options. Local value for a global-local number/boolean option is now unset when the option is set (e.g. using `:set` or `nvim_set_option_value`) without a scope, which means they now behave the same way as string options.

Ref: #25672
2023-10-30 21:38:02 +06:00
Maria José Solano
0fe0cf5ada
fix(lsp): do not cancel snippet when selecting placeholder (#25835) 2023-10-30 12:58:28 +01:00
dundargoc
2dc9ceb99c
docs: small fixes (#25585)
Co-authored-by: tmummert <doczook@gmx.de>
Co-authored-by: parikshit adhikari <parikshitadhikari@gmail.com>
2023-10-29 16:02:32 +08:00
Raphael
0da27e9bde
fix(api): load buffer first on nvim_buf_set_lines (#25823)
Fix #22670
Fix #8659
2023-10-29 15:44:52 +08:00
zeertzjq
82b1a389ba
fix(terminal): avoid Insert mode in Terminal buffer (#25820) 2023-10-29 09:32:03 +08:00
Christian Clason
c34e816608 vim-patch:9.0.2079: Not all Dart files detected
Problem:  Not all Dart files detected
Solution: Add shebang filetype detection for Dart

closes: vim/vim#13449

c1c177a47b

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2023-10-29 01:36:51 +02:00
luukvbaal
f2fb05238a
vim-patch:9.0.2081: smoothscroll may result in wrong cursor position (#25815)
Problem:  With 'smoothscroll' set, "w_skipcol" is not reset when unsetting 'wrap'.
          Resulting in incorrect calculation of the cursor position.
Solution: Reset "w_skipcol" when unsetting 'wrap'.

fixes:  vim/vim#12970
closes: vim/vim#13439

1bf1bf569b
2023-10-29 06:05:29 +08:00
Famiu Haque
43a7945f1b test: add test coverage for #25741 2023-10-28 22:51:07 +06:00
zeertzjq
ac353e87ae
vim-patch:9.0.2075: TextChangedI may not always trigger (#25808)
Problem:  TextChangedI may not always trigger
Solution: trigger it in more cases: for insert/
          append/change operations, and when
          opening a new line,

fixes: vim/vim#13367
closes: vim/vim#13375

4bca4897a1

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-10-28 10:42:18 +08:00
zeertzjq
063a78fda2 vim-patch:9.0.2077: CI fails because of trailing whitespace in test
Problem:  CI fails because of trailing whitespace in test
Solution: Remove it

87ca5e86fa

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-10-28 06:17:08 +08:00
zeertzjq
0b23207c73 vim-patch:9.0.2074: Completion menu may be wrong
Problem:  Completion menu may be wrong
Solution: Check for the original direction of the completion menu,
          add more tests, make it work with 'noselect'

completion: move in right direction when  filling completion_info()

When moving through the insert completion menu and switching directions,
we need to make sure we start at the correct position in the list and
move correctly forward/backwards through it, so that we do not skip
entries and the selected item points to the correct entry in the list
of completion entries generated by the completion_info() function.

The general case is this:

1) CTRL-X CTRL-N, we will traverse the list starting from
   compl_first_match and then go forwards (using the cp->next pointer)
   through the list (skipping the very first entry, which has the
   CP_ORIGINAL_TEXT flag set (since that is the empty/non-selected entry

2) CTRL-X CTRL-P, we will traverse the list starting from
   compl_first_match (which now points to the last entry). The previous
   entry will have the CP_ORIGINAL_TEXT flag set, so we need to start
   traversing the list from the second prev pointer.

There are in fact 2 special cases after starting the completion menu
with CTRL-X:

3)  CTRL-N and then going backwards by pressing CTRL-P again.
    compl_first_match will point to the same entry as in step 1 above,
    but since compl_dir_foward() has been switched by pressing CTRL-P
    to backwards we need to pretend to be in still in case 1 and still
    traverse the list in forward direction using the cp_next pointer

4)  CTRL-P and then going forwards by pressing CTRL-N again.
    compl_first_match will point to the same entry as in step 2 above,
    but since compl_dir_foward() has been switched by pressing CTRL-N
    to forwards we need to pretend to be in still in case 2 and still
    traverse the list in backward direction using the cp_prev pointer

For the 'noselect' case however, this is slightly different again. When
going backwards, we only need to go one cp_prev pointer back. And
resting of the direction works again slightly different. So we need to
take the noselect option into account when deciding in which direction
to iterate through the list of matches.

related: vim/vim#13402
related: vim/vim#12971
closes: vim/vim#13408

daef8c7437

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-10-28 06:16:55 +08:00
Jongwook Choi
add1b10b79
fix(diagnostic): virtual_text prefix function should have index and total (#25801)
The prefix option of the diagnostic virtual text can be a function,
but previously it was only a function of diagnostic.

This function should also have additional parameters index and total,
more consistently and similarily as in the prefix function for
`vim.diagnostic.open_float()`.

These additional parameters will be useful when there are too many
number of diagnostics in a single line.
2023-10-27 08:17:46 -05:00
Christian Clason
5753e5e7eb vim-patch:9.0.2071: objdump files not recognized
Problem:  objdump files not recognized
Solution: detect *.objdump files, add a filetype plugin

Added the objdump file/text format

closes: vim/vim#13425

10407df7a9

Co-authored-by: Colin Kennedy <colinvfx@gmail.com>
2023-10-27 10:03:09 +02:00
zeertzjq
9dc440400c
vim-patch:9.0.2068: [security] overflow in :history (#25794)
Problem:  [security] overflow in :history
Solution: Check that value fits into int

The get_list_range() function, used to parse numbers for the :history
and :clist command internally uses long variables to store the numbers.
However function arguments are integer pointers, which can then
overflow.

Check that the return value from the vim_str2nr() function is not larger
than INT_MAX and if yes, bail out with an error. I guess nobody uses a
cmdline/clist history that needs so many entries... (famous last words).

It is only a moderate vulnerability, so impact should be low.

Github Advisory:
https://github.com/vim/vim/security/advisories/GHSA-q22m-h7m2-9mgm

9198c1f2b1

N/A patch:
vim-patch:9.0.2073: typo in quickfix.c comments

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-10-27 06:37:52 +08:00
Lajos Koszti
ba6761eafe
fix(lsp): fix omnicomplete in middle of the line (#25787)
Fixes a regression from 5e5f5174e3

Until that commit we had a logic like this:
`local prefix = startbyte and line:sub(startbyte + 1) or line_to_cursor:sub(word_boundary)`

The commit changed the logic and no longer cut off the line at the cursor,  resulting in a prefix that included trailing characters
2023-10-26 22:40:36 +02:00
Maria José Solano
15983cf2c6
fix(lsp): cancel session when leaving snippet region (#25762) 2023-10-26 07:29:05 +02:00
nwounkn
9de157bce4
fix(float): win_get_bordertext_col returning negative column number (#25752)
Problem:
  `win_get_bordertext_col` returns column < 1 for right or center
  aligned text, if its length is more than window width.

Solution:
  Return max(resulting_column, 1)
2023-10-26 11:44:28 +08:00
zeertzjq
f2fc44550f
vim-patch:9.0.2064: cannot use buffer-number for errorformat (#25782)
Problem:  cannot use buffer-number for errorformat
Solution: add support for parsing a buffer number using '%b' in
          'errorformat'

closes: vim/vim#13419

b731800522

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-10-26 07:42:29 +08:00
zeertzjq
684e93054b
fix(terminal): assign channel to terminal earlier (#25771) 2023-10-25 09:59:02 +08:00
Christian Clason
0b1ec3b162 vim-patch:9.0.2063: pacman hooks are detected as conf filetype
Problem:  pacman hooks are detected as conf filetype
Solution: make it consistent to pacman.conf and detect those
          hooks as confini

Because confini has much better syntax highlighting than conf.

For reference, I identified pacman.conf and pacman hooks as dosini in
https://github.com/vim/vim/pull/6335, then
https://github.com/vim/vim/pull/10213 changed them to conf, then
https://github.com/vim/vim/pull/10518 changed pacman.conf to confini but
forgot to change hooks.

closes: vim/vim#13399

7d254dbc2d

Co-authored-by: Guido Cella <guido@guidocella.xyz>
2023-10-24 10:15:47 +02:00
Christian Clason
4f0adb6a78 vim-patch:9.0.2062: Janet files are not recognised
Problem:  Janet files are not recognised
Solution: Add filename and shebang detection (without
          adding an extra filetype plugin)

Those are used by the Janet language:
http://www.janet-lang.org

closes: vim/vim#13400

c038427d2a

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2023-10-24 10:15:47 +02:00
Christian Clason
94fee35446 vim-patch:9.0.2061: not able to detect xkb filetypes
Problem:  not able to detect xkb filetypes
Solution: Detect files below /u/s/X11/xkb as xkb files (without adding
          an extra filetype)

Those files are used from the X11 xkb extension

closes: vim/vim#13401

ae9021a840

Co-authored-by: Guido Cella <guido@guidocella.xyz>
2023-10-24 10:15:47 +02:00
Christian Clason
5f0224e848 vim-patch:9.0.2060: *.{gn,gni} files are not recognized
Problem:  *.{gn,gni} files are not recognized
Solution: Detect some as gn filetype (without adding an extra filetype)

Those come from: https://gn.googlesource.com/gn/

closes: vim/vim#13405

84394f2be4

Co-authored-by: Amaan Qureshi <amaanq12@gmail.com>
2023-10-24 10:15:47 +02:00
zeertzjq
d432bba4e4
fix(marks): handle switching buffer properly (#25763) 2023-10-24 16:10:36 +08:00
Maria José Solano
94127cb5df fix(lsp): do not add extra indentation 2023-10-23 17:21:41 +02:00
Maria José Solano
370232dbef fix(lsp): track snippet deletion 2023-10-23 17:21:41 +02:00
Mathias Fussenegger
5e5f5174e3 fix(lsp): fix off-by-one error for omnifunc word boundary
Fixes https://github.com/neovim/neovim/issues/25177

I initially wanted to split this into a refactor commit to make it more
testable, but it appears that already accidentally fixed the issue by
normalizing lnum/col to 0-indexing
2023-10-23 08:26:38 +02:00
glepnir
ae4ca4edf8 feat(complete): support f flag for complete buffer part 2023-10-21 20:06:36 +08:00
Mathias Fussenegger
195301c609 refactor(lsp): deprecate completion util methods
Relates to https://github.com/neovim/neovim/issues/25272
2023-10-21 13:49:05 +02:00
zeertzjq
9971bea6f1
vim-patch:9.0.2059: outstanding exceptions may be skipped (#25736)
Problem:  outstanding exceptions may be skipped
Solution: When restoring exception state, process remaining outstanding
          exceptions

closes: vim/vim#13386

0ab500dede

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-10-21 18:46:52 +08:00
zeertzjq
c049ce56cd
vim-patch:9.0.2058: tests: avoid error when no swap files exist (#25735)
Problem:  tests: avoid error when no swap files exist
Solution: use unlet! so that no error message is reported
          in case the variable does not exists

When s:GetSwapFileList() does not find any swapfiles, it will return an
empty list []. This means, that the variable 'name' will not be
declared, cause the following unlet command to fail and causing a 1 sec
delay on running the tests.

So let's instead use the :unlet! command which simply skips reporting an
error when the variable given as parameter does not exists.

closes: vim/vim#13396

a36acb7ac4
2023-10-21 18:14:32 +08:00
Maria José Solano
f1775da07f
feat(lsp): add snippet API (#25301) 2023-10-21 08:51:26 +02:00
zeertzjq
7a6e27958a
ci(cirrus): don't run lua/help_spec (#25498) 2023-10-21 07:21:19 +08:00
Famiu Haque
6c87d3e0fb refactor(options): get_option_value_strict() and SREQ_*
`SREQ_*` values are now actual typedef'd enums. `get_option_value_strict()` has also been refactored and split into two functions, `get_option_attrs()` for getting the option attributes, and `get_option_value_strict()` for getting the actual value. Moreover, it now returns an `OptVal`. Other miscellaneous refactors have also been made.
2023-10-20 13:35:47 +01:00
Christian Clason
f4b896198f vim-patch:9.0.2056: no digraph for quadruple prime
Problem:  no digraph for quadruple prime
Solution: add quadruple prime digraph using 4'

closes: vim/vim#13380

47416d1a74

Co-authored-by: Jonathan Wright <quaggy@gmail.com>
2023-10-20 13:03:36 +02:00
Gregory Anders
3ea13bca14 vim-patch:9.0.2053: zig filetype detection test wrong
Problem:  zig filetype detection test wrong
Solution: Remove .zir pattern, add new test for .zon pattern

closes: vim/vim#13389

a8c664a042

Co-authored-by: Gregory Anders <greg@gpanders.com>
2023-10-19 13:06:58 -05:00
zeertzjq
a096165977
vim-patch:9.0.2050: Vim9: crash with deferred function call and exception (#25715)
Problem:  Vim9: crash with deferred function call and exception
Solution: Save and restore exception state

Crash when a deferred function is called after an exception and another
exception is thrown

closes: vim/vim#13376
closes: vim/vim#13377

c59c1e0d88

The change in check_due_timer() is N/A as Nvim calls timer callbacks on
the main loop.

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-10-19 18:34:48 +08:00
zeertzjq
09fb243bdd vim-patch:9.0.2045: tests: checking for swap files takes time
Problem:  tests: checking for swap files takes time
Solution: don't check for swap files  when test has been skipped

Check for swap files takes a considerable about of time, so don't do
that for skipped tests to avoid wasting time.

closes: vim/vim#13371

a0e1f06f04
2023-10-18 18:30:20 +08:00
zeertzjq
9e3640a779 vim-patch:9.0.2044: Vim9: exceptions confuse defered functions
Problem:  Vim9: exceptions confuse defered functions
Solution: save and restore exception state when calling defered
          functions

closes: vim/vim#13364
closes: vim/vim#13372

0672595fd5

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-10-18 18:29:47 +08:00
zeertzjq
366d0c7887
fix(move): check the correct buffer (#25698) 2023-10-18 10:34:55 +08:00
zeertzjq
bbc74d51ad
test(autocmd/termxx_spec): fix flakiness (#25694) 2023-10-18 07:19:29 +08:00
zeertzjq
4db4168aaf
vim-patch:8.2.4497: wrong color for half of wide character next to pum scrollbar (#25693)
Problem:    Wrong color for half of wide character next to pum scrollbar.
Solution:   Redraw the screen cell with the right color. (closes vim/vim#9874)

35d8c2010e

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-10-18 06:40:08 +08:00
zeertzjq
bc5dfda441
vim-patch:9.0.2041: trim(): hard to use default mask (#25692)
Problem:  trim(): hard to use default mask (partly revert v9.0.2040)
Solution: use default mask when it is empty

The default 'mask' value is pretty complex, as it includes many
characters.  Yet, if one needs to specify the trimming direction, the
third argument, 'trim()' currently requires the 'mask' value to be
provided explicitly.

Currently, an empty 'mask' will make 'trim()' call return 'text' value
that is passed in unmodified.  It is unlikely that someone is using it,
so the chances of scripts being broken by this change are low.

Also, this reverts commit 9.0.2040 (which uses v:none for the default
and requires to use an empty string instead).

closes: vim/vim#13358

8079917447

vim-patch:9.0.2040: trim(): hard to use default mask

Problem:  trim(): hard to use default mask
Solution: Use default 'mask' when it is v:none

The default 'mask' value is pretty complex, as it includes many
characters.  Yet, if one needs to specify the trimming direction, the
third argument, 'trim()' currently requires the 'mask' value to be
provided explicitly.

'v:none' is already used to mean "use the default argument value" in
user defined functions.  See |none-function_argument| in help.

closes: vim/vim#13363

6e6386716f

Co-authored-by: Illia Bobyr <illia.bobyr@gmail.com>
2023-10-18 06:08:14 +08:00
zeertzjq
272ef27115
vim-patch:9.0.2035: [security] use-after-free with wildmenu (#25687)
Problem:  [security] use-after-free with wildmenu
Solution: properly clean up the wildmenu when exiting

Fix wildchar/wildmenu/pum memory corruption with special wildchar's

Currently, using `wildchar=<Esc>` or `wildchar=<C-\>` can lead to a
memory corruption if using wildmenu+pum, or wrong states if only using
wildmenu. This is due to the code only using one single place inside the
cmdline process loop to perform wild menu clean up (by checking
`end_wildmenu`) but there are other odd situations where the loop could
have exited and we need a post-loop clean up just to be sure. If the
clean up was not done you would have a stale popup menu referring to
invalid memory, or if not using popup menu, incorrect status line (if
`laststatus=0`).

For example, if you hit `<Esc>` two times when it's wildchar, there's a
hard-coded behavior to exit command-line as a failsafe for user, and if
you hit `<C-\><C-\><C-N>` it will also exit command-line, but the clean
up code would not have hit because of specialized `<C-\>` handling.

Fix Ctrl-E / Ctrl-Y to not cancel/accept wildmenu if they are also
used for 'wildchar'/'wildcharm'. Currently they don't behave properly,
and also have potentially memory unsafe behavior as the logic is
currently not accounting for this situation and try to do both.
(Previous patch that addressed this: vim/vim#11677)

Also, correctly document Escape key behavior (double-hit it to escape)
in wildchar docs as it's previously undocumented.

In addition, block known invalid chars to be set in `wildchar` option,
such as Ctrl-C and `<CR>`. This is just to make it clear to the user
they shouldn't be set, and is not required for this bug fix.

closes: vim/vim#13361

8f4fb007e4

Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2023-10-17 22:43:42 +08:00
zeertzjq
356a6728ac
vim-patch:9.0.2037: A few remaining cmdline completion issues with C-E/Y (#25686)
Problem:  A few remaining cmdline completion issues with C-E/Y
Solution: Fix cmdline completion fuzzy/Ctrl-E/Ctrl-Y/options when not
          used at the end

Fix cmdline completion fuzzy/Ctrl-E/Ctrl-Y/options when not used at the end

A few places in the cmdline completion code only works properly when the
user hits Tab (or 'wildchar') at the end of the cmdline, even though
it's supposed to work even in the middle of the line.

For fuzzy search, `:e ++ff`, and `:set hl=`, fix completion code to make
sure to use `xp_pattern_len` instead of assuming the entire `xp_pattern`
is the search pattern (since it contains texts after the cursor).

Fix Ctrl-E / Ctrl-Y to not jump to the end when canceling/accepting a
wildmenu completion. Also, make them work even when not using
`set wildoptions+=pum` as there is no drawback to doing so.
(Related issue where this was brought up: vim/vim#13331)

closes: vim/vim#13362

209ec90b9b

Cherry-pick ex_getln.c changes from patch 9.0.2035.

Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2023-10-17 21:42:34 +08:00
zeertzjq
c9963e2212
vim-patch:9.0.2039: completion shows current word after completion restart (#25682)
Problem:  completion shows current word after completion restart
Solution: remove the word being completed after completion restart

The word being completed is shown in a completion list after completion
restart, because it isn't removed from the current buffer before
searching for matches.

Also adjust `Test_complete_add_onechar` to match the new behavior.

closes: vim/vim#13349

2e3cd52fa0

Co-authored-by: nwounkn <nwounkn@gmail.com>
2023-10-17 17:49:22 +08:00
Famiu Haque
5df4fdf253 refactor(options)!: make OptionSet v: values use typval
BREAKING CHANGE: This breaks the OptionSet autocommand, as the `v:` values associated with it (`v:option_new`, `v:option_old`, `v:option_oldlocal` and `v:option_oldglobal`) are now the same type as the option, instead of all option values being converted to strings.
2023-10-17 00:08:47 +06:00
zeertzjq
0818d65528
fix(extmarks): skip virt_text if it is out of window (#25658) 2023-10-15 19:36:19 +08:00
zeertzjq
75b488d3ef
vim-patch:9.0.2025: no cmdline completion for ++opt args (#25657)
Problem:  no cmdline completion for ++opt args
Solution: Add cmdline completion for :e ++opt=arg and :terminal
          [++options]

closes: vim/vim#13319

989426be6e

Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2023-10-15 17:52:08 +08:00
zeertzjq
d974a3dcbb
vim-patch:9.0.2032: cannot get mouse click pos for tab or virt text (#25653)
Problem:  Cannot accurately get mouse clicking position when clicking on
          a TAB or with virtual text.
Solution: Add a "coladd" field to getmousepos() result.

closes: vim/vim#13335

f5a94d5165
2023-10-15 17:19:01 +08:00
zeertzjq
a350fb2976
vim-patch:9.0.2031: TextChangedI may be triggered by non-insert mode change (#25656)
Problem:  `TextChangedI` can trigger on entering Insert mode if there
          was previously a change not in Insert mode.
Solution: Make it trigger only when text is actually changed in Insert
          mode.

closes: vim/vim#13265
closes: vim/vim#13338

d7ae263af8

Co-authored-by: Evgeni Chasnovski <evgeni.chasnovski@gmail.com>
2023-10-15 17:14:18 +08:00
zeertzjq
85ddd0074b
test(terminal/channel_spec): fix flakiness (#25649) 2023-10-15 06:38:43 +08:00
Christian Clason
729a9c4c61 vim-patch:9.0.2024: no filetype detection for Debian sources
Problem:  no filetype detection for Debian sources
Solution: Add new deb822sources filetype

closes: vim/vim#13320

bd734c3bea

Co-authored-by: James McCoy <jamessan@jamessan.com>
2023-10-14 16:41:33 +02:00
zeertzjq
af4985feda
test(winscrolled): make sure floating window is drawn (#25639) 2023-10-14 20:09:49 +08:00
zeertzjq
bcda800933
vim-patch:9.0.2022: getmousepos() returns wrong index for TAB char (#25636)
Problem:  When clicking in the middle of a TAB, getmousepos() returns
          the column of the next char instead of the TAB.
Solution: Break out of the loop when the vcol to find is inside current
          char. Fix invalid memory access when calling virtcol2col() on
          an empty line.

closes: vim/vim#13321

b583eda703
2023-10-14 19:18:25 +08:00
Maria José Solano
ee156ca60e
fix(lsp): refactor escaping snippet text (#25611) 2023-10-14 09:06:40 +02:00
nwounkn
13f55750e9 fix(ui): empty line before the next message after :silent command
Problem:
  The next command after `silent !{cmd}` or `silent lua print('str')`
  prints an empty line before printing a message, because these commands
  set `msg_didout = true` despite not printing any messages.

Solution:
  Set `msg_didout = true` only if `msg_silent == 0`
2023-10-14 14:23:08 +08:00
zeertzjq
ce0f80835a
test(ui/searchhl_spec): match more in :terminal test (#25631) 2023-10-14 13:53:52 +08:00
zeertzjq
bf70a33f5e
vim-patch:8.1.0822: peeking and flushing output slows down execution (#25629)
Problem:    Peeking and flushing output slows down execution.
Solution:   Do not update the mode message when global_busy is set.  Do not
            flush when only peeking for a character. (Ken Takata)

cb574f4154
2023-10-14 09:58:30 +08:00
zeertzjq
9f32deba56
fix(grid): add start column when getting char on line (#25627) 2023-10-13 21:43:06 +08:00
Jongwook Choi
ebe489d8f0
fix: allow multiline message for echoerr (#25380)
PROBLEM:

Currently `:echoerr` prints multi-line strings in a single line
as `:echom` does (Note: `:echon` can print multi-line strings well).
This makes stacktrace printed via echoerr difficult to read.

Example code:

    try
      lua error("lua stacktrace")
    catch
      echoerr v:exception
    endtry

Output:

    Error detected while processing a.vim[5]..a.vim:
    line    4:
    Vim(lua):E5108: Error executing lua [string ":lua"]:1: lua stacktrace^@stack traceback:^@^I[C]: in function 'error'^@^I[string ":lua"]:1: in main chunk

SOLUTION:

Allow echoerr to print multiline messages (e.g., lua exceptions),
because this command is usually used to print stacktraces.

Output after the fix:

    Error detected while processing a.vim[5]..a.vim:
    line    4:
    Vim(lua):E5108: Error executing lua [string ":lua"]:1: lua stacktrace
    stack traceback:
            [C]: in function 'error'
            [string ":lua"]:1: in main chunk
2023-10-13 07:27:45 +08:00
Justin M. Keyes
2c9f22e7e4
refactor(test): cleanup #25614
- unnecessary separate describe() group
- clear() wasn't called in the describe() group
- unnecessary indirection in function parameters
2023-10-12 07:04:16 -07:00
L Lllvvuu
9c2270b834 feat(types): add test/.luarc.json
Authored-By: Lewis Russell <lewis6991@gmail.com>
Co-Authored-By: Lewis Russell <lewis6991@gmail.com>
2023-10-12 09:50:29 +01:00
zeertzjq
840e1864c2
fix(lsp): handle NUL bytes in popup text (#25612)
Fix #25610
2023-10-12 15:39:39 +08:00
zeertzjq
d2d38858d1
vim-patch:9.0.2018: complete_info() returns wrong index (#25607)
Problem:  complete_info() returns wrong index
Solution: Make order of 'info' in completion_info consistent

Start the iteration from the same point and follow the same direction as
done when assigning the completion numbers. This way we remove the
dependence on the completion direction and make the order of 'info'
consistent.

closes: vim/vim#12230
closes: vim/vim#12971

69fb5afb3b

Co-authored-by: LemonBoy <thatlemon@gmail.com>
2023-10-12 08:21:01 +08:00
zeertzjq
3cbb02ce77
vim-patch:8.2.3064: Vim9: in script cannot set item in uninitialized list (#25605)
Problem:    Vim9: in script cannot set item in uninitialized list.
Solution:   When a list is NULL allocate an empty one. (closes vim/vim#8461)

e65081d1b5

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-10-12 07:38:56 +08:00
zeertzjq
e2406d119f
vim-patch:9.0.2017: linebreak applies for leading whitespace (#25604)
Problem:  linebreak applies for leading whitespace
Solution: only apply linebreak, once we have found non-breakat chars in
          the line

closes: vim/vim#13228
closes: vim/vim#13243

dd75fcfbdf

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-10-12 06:49:11 +08:00
Christian Clason
7474874baa vim-patch:9.0.2011: INI files not detected
Problem:  INI files not detected
Solution: detect uppercase .INI as dosini files

It previo~1 only worked for lower-case .ini files, but upperc~1 .INI is
also somewhat common on account of DOS' old 8.3 upperc~2 only filena~1.

closes: vim/vim#13316

4a82bdfaa8

Co-authored-by: Martin Tournoij <martin@arp242.net>
2023-10-11 23:54:41 +02:00
Raphael
f79052faef
refactor(float): rename ex_floatclose to ex_fclose (#25596) 2023-10-11 15:03:59 +08:00
zeertzjq
4eea60939f
test(core/path_spec): don't use fnameescape() (#25593)
Using fnameescape() for the path argument of findfile() and finddir() is
wrong, as fnameescape() is intended to be used for parts of Ex commands,
not function arguments.
2023-10-11 07:24:37 +08:00
dundargoc
c3d21ad1bc docs: small fixes
Co-authored-by: Wansmer <wansmer@gmail.com>
Co-authored-by: Andrew Voynov <andrewvoynov.b@gmail.com>
Co-authored-by: David Moberg <david.moberg@mediatek.com>
2023-10-10 19:20:32 +02:00
bfredl
fd39f5ce8c
Merge pull request #25561 from glepnir/9663
feat(float): add fclose command
2023-10-10 16:36:55 +02:00
glepnir
372aa2eb3d feat(float): add fclose command 2023-10-10 21:17:08 +08:00
Evgeni Chasnovski
a2f17e97ec
fix(highlight): add FloatFooter to 'highlight_defs.h' (#25577) 2023-10-10 17:33:30 +08:00
zeertzjq
c40a1c0f41
vim-patch:9.0.2009: cmdline-completion for comma-separated options wrong (#25569)
Problem:  cmdline-completion for comma-separated options wrong
Solution: Fix command-line expansions for options with filenames with
          commas

Fix command-line expansions for options with filenames with commas

Cmdline expansion for option values that take a comma-separated list
of file names is currently not handling file names with commas as the
commas are not escaped. For such options, the commas in file names need
to be escaped (to differentiate from a comma that delimit the list
items). The escaped comma is unescaped in `copy_option_part()` during
option parsing.

Fix as follows:
- Cmdline completion for option values with comma-separated file/folder
  names will not start a new match when seeing `\\,` and will instead
  consider it as one value.
- File/folder regex matching will strip the `\\` when seeing `\\,` to
  make sure it can match the correct files/folders.
- The expanded value will escape `,` with `\\,`, similar to how spaces
  are escaped to make sure the option value is correct on the cmdline.

This fix also takes into account the fact that Win32 Vim handles file
name escaping differently. Typing '\,' for a file name results in it
being handled literally but in other platforms '\,' is interpreted as a
simple ',' and commas need to be escaped using '\\,' instead.

Also, make sure this new logic only applies to comma-separated options
like 'path'. Non-list options like 'set makeprg=<Tab>' and regular ex
commands like `:edit <Tab>` do not require escaping and will continue to
work.

Also fix up documentation to be clearer. The original docs are slightly
misleading in how it discusses triple slashes for 'tags'.

closes: vim/vim#13303
related: vim/vim#13301

54844857fd

Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2023-10-10 09:15:21 +08:00
Leonardo Mello
81f67b79e8
fix(file_search): path with spaces in finddir() and findfile() (#25493)
Co-authored-by: dundargoc <gocdundar@gmail.com>
2023-10-10 06:08:58 +08:00
zeertzjq
4ab2b43c8f
vim-patch:9.0.2008: test: undofile left behind (#25567)
Problem:  test: undofile left behind
Solution: cleanup undofile

fix: tmp file not deleted when running make test_undo

Temporary file `.Xtestfile.txt.un~` was left running `make test_undo`
and vim was configured with:
```
./configure --with-features=normal --enable-gui=no --enable-terminal
```

closes: vim/vim#13304

b07b9dc4da

Co-authored-by: Dominique Pellé <dominique.pelle@tomtom.com>
2023-10-10 05:56:28 +08:00
ii14
139e6f68f9
fix(autocmd): API functions accept garbage after event name #25523
"VimEnter foo" was accepted as a valid event name for "VimEnter".
Events delimited with commas, eg. "VimEnter,BufRead", were also
accepted, even though only the first event was actually parsed.

Co-authored-by: ii14 <ii14@users.noreply.github.com>
2023-10-09 02:50:44 -07:00
Jaehoon Hwang
dacd34364f
feat(ui-ext): make 'mousehide' into proper ui_option (#25532) 2023-10-09 16:48:24 +08:00
zeertzjq
f96f8566b5
test(ui/embed_spec): use notification instead of request (#25555)
This avoid the hang mentioned in #24888, and also matches TUI better.
2023-10-09 16:14:37 +08:00
bfredl
61f1e992ce
Merge pull request #25503 from bfredl/unishape
refactor(grid): do arabic shaping in one place
2023-10-08 23:32:24 +02:00
bfredl
ddef39299f refactor(grid): do arabic shaping in one place
The 'arabicshape' feature of vim is a transformation of unicode text to
make arabic and some related scripts look better at display time. In
particular the content of a cell will be adjusted depending on the
(original) content of the cells just before and after it.

This is implemented by the arabic_shape() function in nvim. Before this
commit, shaping was invoked in four different contexts:

- when rendering buffer text in win_line()
- in line_putchar() for rendering virtual text
- as part of grid_line_puts, used by messages and statuslines and
  similar
- as part of draw_cmdline() for drawing the cmdline

This replaces all these with a post-processing step in grid_put_linebuf(),
which has become the entry point for all text rendering after recent
refactors.

An aim of this is to make the handling of multibyte text yet simpler.
One of the main reasons multibyte chars needs to be "parsed" into
codepoint arrays of composing chars is so that these could be inspected
for the purpose of shaping. This can likely be vastly simplified in many
contexts where only the total length (in bytes) and width of composed
char is needed.
2023-10-08 15:22:45 +02:00
LW
9abced6ad9
fix(lsp): account for border height in max floating popup height (#25539) 2023-10-08 10:09:25 +02:00
bfredl
1f864139b2
Merge pull request #25522 from glepnir/4334
fix(ui): trigger TabNewEntered after split new tab
2023-10-07 11:10:28 +02:00
glepnir
1cd7824dd6 fix(ui): trigger TabNewEntered after split new tab 2023-10-07 16:40:57 +08:00
zeertzjq
1ac588543d
vim-patch:9.0.1995: Invalid memory access with empty 'foldexpr' (#25530)
Problem:  Invalid memory access when 'foldexpr' returns empty string.
Solution: Check for NUL.

closes: vim/vim#13293

a991ce9c08
2023-10-07 06:32:06 +08:00
Aayush Ojha
5db076c7cc
fix(lua): vim.region on linewise selection #25467
fixes #18155
2023-10-06 05:44:50 -07:00
Justin M. Keyes
133e2990ef refactor: cleanup 2023-10-06 14:09:21 +02:00
Leonardo Mello
1dd700a8d9 fix: gf fails on "foo/bar.txt:1:2" on Windows
Problem:
On Windows, "gf" fails on a filepath that has a line:column suffix.
Example:

    E447: Can't find file "src/app/core/services/identity/identity.service.ts:64:23"

Solution:
- Remove ":" from 'isfname' on Windows. Colon is not a valid filename
  character (except for the drive-letter).
- Handle drive letters specially in file_name_in_line().

Fixes #25160
2023-10-06 12:59:58 +02:00
bfredl
4e4ad4312e
Merge pull request #25513 from bfredl/cleangrid
refactor(grid): get rid of unbatched grid_puts and grid_putchar
2023-10-06 11:21:46 +02:00
bfredl
a58bb21544 refactor(grid): get rid of unbatched grid_puts and grid_putchar
This finalizes the long running refactor from the old TUI-focused grid
implementation where text-drawing cursor was not separated from the
visible cursor.

Still, the pattern of setting cursor position together with updating a
line was convenient. Introduce grid_line_cursor_goto() to still allow
this but now being explicit about it.

Only having batched drawing functions makes code involving drawing
a bit longer. But it is better to be explicit, and this highlights
cases where multiple small redraws can be grouped together. This was the
case for most of the changed places (messages, lastline, and :intro)
2023-10-06 10:16:30 +02:00
Christian Clason
1338140ee3 vim-patch:9.0.1978: No filetype detection for just files
Problem:  No filetype detection for just files
Solution: Detect just files (*.just, justfile, etc)

closes: vim/vim#13271

3d90f71b76

vim-patch:b6d01f13: runtime(just): Correct filetype detection pattern and style

Co-authored-by: dundargoc <gocdundar@gmail.com>
2023-10-06 09:52:24 +02:00
zeertzjq
5f4f83ba32
vim-patch:9.0.1983: scrolling inactive window not possible with cursorbind (#25507)
Problem:  Scrolling non-current window using mouse is inconsistent
          depending on 'scrollbind'/'scrolloff' and different from GUI
          vertical scrollbar when 'cursorbind' is set.
Solution: Don't move cursor in non-current windows for 'cursorbind' if
          cursor in the current window didn't move.

closes: vim/vim#13219
closes: vim/vim#13210

8e5f26ec6a
2023-10-05 07:48:37 +08:00
zeertzjq
d7a240b1e9
vim-patch:9.0.1981: not being able to scroll up in diff mode (#25506)
Problem:  Cannot scroll up in diff mode with many filler lines and zero
          'scrolloff'.
Solution: Invalidate w_cline_row before calling comp_botline().

closes: vim/vim#13256

0583491277
2023-10-05 07:36:14 +08:00
bfredl
3079fa1f9f
Merge pull request #25491 from glepnir/25474
fix(highlight): attr set all when normal attr changed
2023-10-04 16:24:33 +02:00
Justin M. Keyes
29fe883aa9
feat: ignore swapfile for running Nvim processes #25336
Problem:
The swapfile "E325: ATTENTION" dialog is displayed when editing a file
already open in another (running) Nvim. Usually this behavior is
annoying and irrelevant:
- "Recover" and the other options ("Open readonly", "Quit", "Abort") are
  almost never wanted.
- swapfiles are less relevant for "multi-Nvim" since 'autoread' is
  enabled by default.
  - Even less relevant if user enables 'autowrite'.

Solution:
Define a default SwapExists handler which does the following:
1. If the swapfile is owned by a running Nvim process, automatically
   chooses "(E)dit anyway" (caveat: this creates a new, extra swapfile,
   which is mostly harmless and ignored except by `:recover` or `nvim -r`.
2. Shows a 1-line "ignoring swapfile..." message.
3. Users can disable the default SwapExists handler via `autocmd! nvim_swapfile`.
2023-10-04 06:31:25 -07:00
glepnir
d4872377fe fix(highlight): attr set all when normal attr changed 2023-10-04 18:42:13 +08:00
Leonardo Mello
1e7e9ee91f
fix(path): accept special characters on Windows (#25424) 2023-10-04 06:04:19 +08:00
bfredl
70ec8d60e0
Merge pull request #25470 from bfredl/msg_display
refactor(message): simplify msg_puts_display and use batched grid updates
2023-10-03 20:56:43 +02:00
bfredl
a9a48d6b5f refactor(message): simplify msg_puts_display and use batched grid updates
msg_puts_display was more complex than necessary in nvim, as in
nvim, it no longer talks directly with a terminal.

In particular we don't need to scroll the grid before emiting the last
char. The TUI already takes care of things like that, for terminals
where it matters.
2023-10-03 15:20:09 +02:00
zeertzjq
b2a8a93147
fix(api): avoid immediate TextChanged with nvim_create_buf (#25492) 2023-10-03 20:54:42 +08:00
zeertzjq
3af59a415c
fix(treesitter): make Visual hl work consistently with foldtext (#25484)
Problem:  Visual highlight is inconsistent on a folded line with
          treesitter foldtext.
Solution: Don't added Folded highlight as it is already in background.
2023-10-03 13:07:03 +08:00
zeertzjq
04af9d49ee
test(fileio_spec): fix files not cleaned up properly (#25483) 2023-10-03 12:13:04 +08:00
zeertzjq
e115732465
fix(terminal): check terminal size at end of screen update (#25480) 2023-10-03 10:23:03 +08:00
zeertzjq
bd8550ddca
vim-patch:9.0.1973: Clean up cmdline option completion code (#25477)
Problem:  Clean up cmdline option completion code
Solution: Fix various minor problems

- Fix manual array size calculations to just use `ARRAY_LENGTH()`.
- Fix unintentional typo in comments due to copy-paste error.
- Fix assert_equal() usages to pass the expected value to first
  parameter instead of 2nd one to avoid confusion.
- Fix signed vs unsigned warnings
- Correct misplaced comments about set_op_T and set_prefix_T
  and fix a typo in another comment

closes: vim/vim#13249
closes: vim/vim#13237

6d11347260

N/A patch:
vim-patch:9.0.1976: style: space before tab in optionstr.c

Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2023-10-03 07:45:37 +08:00
zeertzjq
1101cfeb34
vim-patch:9.0.1972: win32: missing '**' expansion test (#25476)
Problem:  win32: missing '**' expansion test (after v9.0.1947)
Solution: Add test for MS-Windows

win32: Add "**" test

Vim supports "**" on MS-Windows. However, it is not tested by
`Test_glob_extended_bash`.

Unlike Unix, it doesn't use 'shell' and doesn't support {,} expansion.
So, I added as a separate test.

related: vim/vim#13205
closes: vim/vim#13250

4a1ad55564

Co-authored-by: Ken Takata <kentkt@csc.jp>
2023-10-03 07:24:54 +08:00
Maria José Solano
eb1f0e8fcc feat(lsp)!: replace snippet parser by lpeg grammar 2023-10-02 22:21:35 +02:00
Mathias Fußenegger
4a09c178a1
feat(lsp): fallback to code-action command on resolve failure (#25464)
The haskell-language-server supports resolve only for a subset of code
actions. For many code actions trying to resolve the `edit` property
results in an error, but the unresolved action already contains a
command that can be executed without issue.

The protocol specification is unfortunately a bit vague about this,
and what the haskell-language-server does seems to be valid.

Example:

    newtype Dummy = Dummy Int
    instance Num Dummy where

Triggering code actions on "Num Dummy" and choosing "Add placeholders
for all missing methods" resulted in:

    -32601: No plugin enabled for SMethod_CodeActionResolve, potentially available: explicit-fields, importLens, hlint, overloaded-record-dot

With this change it will insert the missing methods:

    instance Num Dummy where
      (+) = _
      (-) = _
      (*) = _
      negate = _
      abs = _
      signum = _
      fromInteger = _
2023-10-02 22:14:19 +02:00
Till Bungert
9ce1623837
feat(treesitter): add foldtext with treesitter highlighting (#25391) 2023-10-01 14:10:51 -05:00
zeertzjq
01c51a4913 feat(completion): support completing more string options 2023-10-01 20:00:23 +08:00
zeertzjq
5821c857e0 vim-patch:9.0.1968: cmdline completion should consider key option
Problem:  cmdline completion should consider key option
Solution: Disable cmdline completion for key option, slightly
          refactor how P_NO_CMD_EXPAND is handled

Harden crypto 'key' option: turn off cmdline completion, disable set-=

"set-=" can be used maliciously with a crypto key, as it allows an
attacker (who either has access to the computer or a plugin author) to
guess a substring by observing the modified state. Simply turn off
set+=/-=/^= for this option as there is no good reason for them to be
used.

Update docs to make that clear as well.

Also, don't allow cmdline completion for 'key' as it just shows *****
which is not useful and confusing to the user what it means (if the user
accidentally hits enter they will have replaced their key with "*****"
instead).

Move logic to better location, don't use above 32-bit for flags

Move P_NO_CMD_EXPAND to use the unused 0x20 instead of going above
32-bits, as currently the flags parameter is only 32-bits on some
systems. Left a comment to warn that future additions will need to
change how the flags work either by making it 64-bit or split into two
member vars.

Also, move the logic for detecting P_NO_CMD_EXPAND earlier so it's not
up to each handler to decide, and you won't see the temporary "..." that
Vim shows while waiting for completion handler to complete.

closes: vim/vim#13224

6ee7b521fa

Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2023-10-01 20:00:23 +08:00
zeertzjq
81be840768 vim-patch:9.0.1961: 'listchars' completion misses "multispace" and "leadmultispace"
Problem:  Cmdline completion for 'listchars' fields doesn't include
          "multispace" and "leadmultispace" (after 9.0.1958).
Solution: Include "multispace" and "leadmultispace" in lcstab.

closes: vim/vim#13225

1f025b01e2
2023-10-01 20:00:23 +08:00
zeertzjq
f06af5e669 vim-patch:9.0.1958: cannot complete option values
Problem:  cannot complete option values
Solution: Add completion functions for several options

Add cmdline tab-completion for setting string options

Add tab-completion for setting string options on the cmdline using
`:set=` (along with `:set+=` and `:set-=`).

The existing tab completion for setting options currently only works
when nothing is typed yet, and it only fills in with the existing value,
e.g. when the user does `:set diffopt=<Tab>` it will be completed to
`set diffopt=internal,filler,closeoff` and nothing else. This isn't too
useful as a user usually wants auto-complete to suggest all the possible
values, such as 'iblank', or 'algorithm:patience'.

For set= and set+=, this adds a new optional callback function for each
option that can be invoked when doing completion. This allows for each
option to have control over how completion works. For example, in
'diffopt', it will suggest the default enumeration, but if `algorithm:`
is selected, it will further suggest different algorithm types like
'meyers' and 'patience'. When using set=, the existing option value will
be filled in as the first choice to preserve the existing behavior. When
using set+= this won't happen as it doesn't make sense.

For flag list options (e.g. 'mouse' and 'guioptions'), completion will
take into account existing typed values (and in the case of set+=, the
existing option value) to make sure it doesn't suggest duplicates.

For set-=, there is a new `ExpandSettingSubtract` function which will
handle flag list and comma-separated options smartly, by only suggesting
values that currently exist in the option.

Note that Vim has some existing code that adds special handling for
'filetype', 'syntax', and misc dir options like 'backupdir'. This change
preserves them as they already work, instead of converting to the new
callback API for each option.

closes: vim/vim#13182

900894b09a

Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2023-10-01 20:00:23 +08:00
bfredl
9b3045103f
Merge pull request #25455 from bfredl/highlight_namespace_getters
feat(ui): allow to get the highlight namespace. closes #24390
2023-10-01 10:39:31 +02:00
zeertzjq
2da66f1f71
vim-patch:9.0.1967: xattr errors not translated (#25454)
Problem:  xattr errors not translated
Solution: mark for translation, consistently capitalize
          first letter.

closes: vim/vim#13236

7ece036d72
2023-10-01 16:29:55 +08:00
Daniel Steinberg
2615ed879e feat(ui): allow to get the highlight namespace 2023-10-01 10:02:36 +02:00
zeertzjq
5c60fbe9db vim-patch:9.0.1963: Configure script may not detect xattr
Problem:  Configure script may not detect xattr correctly
Solution: include sys/xattr instead of attr/xattr,
          make Test_write_with_xattr_support() test
          xattr feature correctly

This also applies to the Smack security feature, so change the include
and configure script for it as well.

closes: vim/vim#13229

6de4e58cf2
2023-09-30 22:09:55 +08:00
zeertzjq
f6e72c3dfe vim-patch:9.0.1962: No support for writing extended attributes
Problem:  No support for writing extended attributes
Solution: Add extended attribute support for linux

It's been a long standing issue, that if you write a file with extended
attributes and backupcopy is set to no, the file will loose the extended
attributes.

So this patch adds support for retrieving the extended attributes and
copying it to the new file. It currently only works on linux, mainly
because I don't know the different APIs for other systems (BSD, MacOSX and
Solaris).  On linux, this should be supported since Kernel 2.4 or
something, so this should be pretty safe to use now.

Enable the extended attribute support with normal builds.

I also added it explicitly to the :version output as well as make it
able to check using `:echo has("xattr")`, to have users easily check
that this is available.

In contrast to the similar support for SELINUX and SMACK support (which
also internally uses extended attributes), I have made this a FEAT_XATTR
define, instead of the similar HAVE_XATTR.

Add a test and change CI to include relevant packages so that CI can
test that extended attributes are correctly written.

closes: vim/vim#306
closes: vim/vim#13203

e085dfda5d

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-09-30 22:09:55 +08:00
zeertzjq
a4132e1d62
test(unit): move statusline tests to statusline_spec.lua (#25441) 2023-09-30 20:38:04 +08:00
bfredl
578d634176
Merge pull request #25386 from glepnir/toggle_float
feat(float): support toggle show float window
2023-09-30 13:40:35 +02:00
glepnir
4200a0f167 feat(float): support toggle show float window 2023-09-30 18:30:23 +08:00
zeertzjq
dc6d0d2daf
refactor: reorganize option header files (#25437)
- Move vimoption_T to option.h
- option_defs.h is for option-related types
- option_vars.h corresponds to Vim's option.h
- option_defs.h and option_vars.h don't include each other
2023-09-30 14:41:34 +08:00
zeertzjq
5f2d0b9329
test(old): don't check for $CLANG_SANITIZER (#25432)
Functional tests don't check for an environment variable before printing
ASAN logs, so oldtests shouldn't either.
2023-09-30 08:35:29 +08:00
zeertzjq
dbfdb52ea8
vim-patch:9.0.1956: Custom completion skips orig cmdline if it invokes glob() (#25427)
Problem:  Custom cmdline completion skips original cmdline when pressing
          Ctrl-P at first match if completion function invokes glob().
Solution: Move orig_save into struct expand_T.

closes: vim/vim#13216

28a23602e8
2023-09-30 06:30:10 +08:00
dundargoc
af7d317f3f refactor: remove long
long is 32-bits even on 64-bit windows which makes the type suboptimal
for a codebase meant to be cross-platform.
2023-09-29 14:56:34 +02:00
James McCoy
9afbfb4d64 fix(unittests): ignore __s128 and __u128 types in ffi
Linux added these types to their userspace headers in [6.5], which
causes unit tests to fail like

```
-------- Running tests from test/unit/api/private_helpers_spec.lua
RUN       vim_to_object converts true: 17.00 ms ERR
test/unit/helpers.lua:748: test/unit/helpers.lua:732: (string) '
test/unit/helpers.lua:264: ';' expected near '__s128' at line 194'
exit code: 256

stack traceback:
	test/unit/helpers.lua:748: in function 'itp_parent'
	test/unit/helpers.lua:784: in function <test/unit/helpers.lua:774>
```

Since we don't use these types, they can be ignored to avoid LuaJIT's C
parser choking on them.

[6.5]: 224d80c584
2023-09-28 22:36:14 -04:00
zeertzjq
7ec20a4082
vim-patch:9.0.1950: Vim9: error codes spread out (#25405)
Problem:  Vim9: error codes spread out
Solution: group them together and reserve 100
          more for future use

Reserve 100 error codes for future enhancements to the Vim9 class
support

closes: vim/vim#13207

413f83990f

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-09-29 06:52:02 +08:00
zeertzjq
3465e0daa0 vim-patch:9.0.1947: Bash Expansion test fails on Windows/MacOS
Problem:  Bash Expansion test fails on Windows/MacOS
Solution: Disable Test_glob_extended_bash for now

This test doesn't work on Windows even if bash can be executed, since
the globstar functionality has only been enabled in Unix builds of Vim
(Commit 9eb1ce531527a7177d16373b0f8689bbcd3d5f73, patch 9.0.1946).

closes: vim/vim#13205

03ca4002c1

Co-authored-by: Ken Takata <kentkt@csc.jp>
2023-09-29 06:07:27 +08:00
zeertzjq
92e40f8d18 vim-patch:9.0.1946: filename expansion using ** in bash may fail
Problem:  filename expansion using ** in bash may fail
Solution: Try to enable the globstar setting

Starting with bash 4.0 it supports extended globbing using the globstar
shell option. This makes matching recursively below a certain directory
using the ** pattern work as expected nowadays.  However, we need to
explicitly enable this using the 'shopt -s globstar' bash command.

So let's check the bash environment variable $BASH_VERSINFO (which is
supported since bash 3.0 and conditionally enable the globstar option,
if the major version is at least 4. For older bashs, this at least
shouldn't cause errors (unless one is using really ancient bash 2.X or
something).

closes: vim/vim#13002
closes: vim/vim#13144

9eb1ce5315

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-09-29 06:07:27 +08:00
zeertzjq
7f58b2bb6a vim-patch:9.0.0607: verbose echo message test fails on Mac OS
Problem:    Verbose echo message test fails on Mac OS.
Solution:   Skip the test on Mac OS.

f802767df7

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-09-29 06:07:27 +08:00
zeertzjq
28ffd96c9b
test: decoration provider with wrapped lines (#25404) 2023-09-28 20:20:25 +08:00
Rory Nesbitt
a66b0fdfaa
feat: NVIM_APPNAME supports relative paths #25233
Problem:
NVIM_APPNAME does not allow path separators in the name, so relative
paths can't be used:

    NVIM_APPNAME="neovim-configs/first-config" nvim
    NVIM_APPNAME="neovim-configs/second-config" nvim

Solution:
Let NVIM_APPNAME be a relative path. Absolute paths are not supported.

fix #23056
fix #24966
2023-09-27 10:09:55 -07:00
bfredl
26d6f03023
Merge pull request #25374 from bfredl/batchupdate
refactor(grid): use batched updates for more things
2023-09-27 13:21:29 +02:00
zeertzjq
10e57ad4cb
vim-patch:8.2.3467: CursorHoldI event interferes with "CTRL-G U" (#25383)
Problem:    CursorHoldI event interferes with "CTRL-G U". (Naohiro Ono)
Solution:   Restore the flag for "CTRL-G U" after triggering CursorHoldI.
            (closes vim/vim#8937)

5a9357d0bf

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-09-27 18:58:43 +08:00
zeertzjq
b65f4151d9
vim-patch:8.2.3517: TextChanged does not trigger after TextChangedI (#25384)
Problem:    TextChanged does not trigger after TextChangedI.
Solution:   Store the tick separately for TextChangedI. (Christian Brabandt,
            closes vim/vim#8968, closes vim/vim#8932)

db3b44640d

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-09-27 18:51:40 +08:00
bfredl
10cabf7877 refactor(grid): use batched updates for statusline and ruler 2023-09-27 11:31:45 +02:00
zeertzjq
dfa8b582a6
fix(extmarks): draw TAB in virt_text properly with 'rl' (#25381) 2023-09-27 10:48:14 +08:00
Justin M. Keyes
de93489789 refactor(tutor): cleanup 2023-09-26 06:41:53 -07:00
Leonardo Mello
bc6fc0123d
fix(tutor): Tutor steps don't work on Windows #25251
Problem:
Some steps in :Tutor don't work on Windows.

Solution:
Add support for `{unix:...,win:...}` format and transform the Tutor contents
depending on the platform.
Fix https://github.com/neovim/neovim/issues/24166
2023-09-26 06:31:35 -07:00
bfredl
fe95037cdb
Merge pull request #25229 from glepnir/20323
fix(highlight): add force in nvim_set_hl
2023-09-26 14:20:10 +02:00
glepnir
f8ea49cfe1 fix(highlight): add force in nvim_set_hl 2023-09-26 19:41:23 +08:00
bfredl
68d425ac92 refactor: remove 'shortmess' save/restore panic for ex commands
This was only used to avoid the effect of SHM_OVERALL. This can easily
be handled in isolation, instead of clearing out all of 'shortmess' which
has unwanted side effects and mystifies what really is going on.
2023-09-25 14:54:20 +02:00
zeertzjq
b3be7b7413
fix(api): handle NUL in nvim_err_write() and nvim_out_write() (#25354) 2023-09-25 11:06:15 +08:00
zeertzjq
9e7c4fe579
fix(exception): remember whether message is multiline (#25351) 2023-09-25 08:23:24 +08:00
zeertzjq
7d4967547b
vim-patch:9.0.1938: multispace wrong when scrolling horizontally (#25348)
Problem:  multispace wrong when scrolling horizontally
Solution: Update position in "multispace" or "leadmultispace" also in
          skipped chars. Reorder conditions to be more consistent.

closes: vim/vim#13145
closes: vim/vim#13147

abc808112e
2023-09-25 06:31:52 +08:00
zeertzjq
9154fc76b7
vim-patch:9.0.1937: missing test for mouse click + 'virtedit' (#25347)
Problem:  missing test for mouse click + 'virtedit'
Solution: Add test for clicking after eol with 'virtualedit' and wrapped
          line

closes: vim/vim#13157

46a0582ffa
2023-09-25 06:23:42 +08:00
zeertzjq
dfa21316cd vim-patch:9.0.1934: :bwipe fails after switching window from aucmd_win.
Problem:  :bwipe fails after switching window from aucmd_win.
Solution: Decrement b_nwindows after switching back to aucmd_win.

closes: vim/vim#13160

46bdae036a
2023-09-25 05:54:38 +08:00
zeertzjq
8728ba3951 vim-patch:9.0.1931: make test_compilers fails on ubuntu
Problem:  make test_compilers fails on ubuntu
Solution: set LC_ALL=C

fix: make test_compiler failed on xubuntu 22.04.3

Problem: 'make test_compiler' failed on Linux xubuntu 22.04.3 but
         succeeded on e.g. macOS. To reproduce:
```
$ ./configure --with-features=huge --enable-gui=no --enable-perlinterp=yes
$ make -j12
$ cd vim/src/testdir
$ make test_compiler
...snip...
Found errors in Test_compiler():
command line..script /home/dope/sb/vim/src/testdir/runtest.vim[601]..function RunTheTest[54]..Test_compiler line 24: command did not fail: clist
command line..script /home/dope/sb/vim/src/testdir/runtest.vim[601]..function RunTheTest[54]..Test_compiler line 30: Pattern '\\n \\d\\+ Xfoo.pl:3: Global symbol "$foo" requires explicit package name' does not match '\n19 Xfoo.pl:3: Global symbol "$foo" requires explicit package name (did you forget to declare "my $foo"?)'
make: *** [Makefile:70: test_compiler] Error 1
```
Solution: set `LC_ALL` to "C" in `Test_compiler()`

closes: vim/vim#13173

ca0ffc0d63

Co-authored-by: Dominique Pellé <dominique.pelle@tomtom.com>
2023-09-25 05:54:38 +08:00
nwounkn
0592fd5e17
fix(ui): "resize -1" with cmdheight=0 #24758
Problem:
Crash from:

    set cmdheight=0 redrawdebug=invalid
    resize -1

Solution:
Do not invalidate first `p_ch` `msg_grid` rows in `update_screen` when
scrolling the screen down after displaying a message, because they may
be used later for drawing cmdline.
Fixes #22154
2023-09-24 11:15:33 -07:00
zeertzjq
ed0d6536e3
test: only trim trailing spaces in swapfile tests (#25341) 2023-09-24 22:03:54 +08:00
zeertzjq
9637b7dae4
fix(startup): stop TUI properly when quitting at swap dialog (#25337) 2023-09-24 16:29:07 +08:00
zeertzjq
ac1c23442f
test(old): don't set options to default before every test (#25335)
Oldtests clean up after themselves, and the options that need operators
to align with Vim all deny duplicates, so there is no need to set them
to default.

Also make the variable name that test_listchars.vim uses to align with
Vim more obvious.
2023-09-24 11:20:23 +08:00
zeertzjq
4d3a38ac07
fix(api, lua): handle setting v: variables properly (#25325) 2023-09-24 10:57:09 +08:00
tj-moody
046c9a83f7
fix(ui): always use stl/stlnc fillchars when drawing statusline (#25267) 2023-09-24 10:49:47 +08:00
zeertzjq
cfb898cd8a
test(tui_spec): small consistency fixes (#25332)
- Make indent consistent.
- Remove outdated "Only single integration test" comment.
- Don't use setup() as function name as it's used by busted.
2023-09-24 08:05:18 +08:00
zeertzjq
fcdfbb4303
fix(float): fix some other crashes with :unhide or :all (#25328) 2023-09-23 22:33:44 +08:00
zeertzjq
5331d5772f
fix(lua): show error message when failing to set variable (#25321) 2023-09-23 15:59:37 +08:00
zeertzjq
c0a29931e2
fix(unhide): close floating windows first (#25318) 2023-09-23 14:42:59 +08:00
zeertzjq
c88bb658ce
vim-patch:8.2.4609: :unhide does not check for failing to close a window (#25317)
Problem:    :unhide does not check for failing to close a window.
Solution:   When closing a window fails continue with the next one.  Do not
            try closing the autocmd window. (closes vim/vim#9984)

6f2465d336

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-09-23 12:41:09 +08:00
zeertzjq
c26b39a9aa
fix(tui): make :cquit work properly with remote TUI (#25313) 2023-09-23 11:00:20 +08:00
L Lllvvuu
e353c869ce fix(languagetree): don't treat unparsed nodes as occupying full range
This is incorrect in the following scenario:
1. The language tree is Lua > Vim > Lua.
2. An edit simultaneously wipes out the `_regions` of all nodes, while
   taking the Vim injection off-screen.
3. The Vim injection is not re-parsed, so the child Lua `_regions` is
   still `nil`.
4. The child Lua is assumed, incorrectly, to occupy the whole document.
5. This causes the injections to be parsed again, resulting in Lua > Vim
   > Lua > Vim.
6. Now, by the same process, Vim ends up with its range assumed over the
   whole document. Now the parse is broken and results in broken
   highlighting and poor performance.

It should be fine to instead treat an unparsed node as occupying
nothing (i.e. effectively non-existent). Since, either:
- The parent was just parsed, hence defining `_regions`
- The parent was not just parsed, in which case this node doesn't need
  to be parsed either.

Also, the name `has_regions` is confusing; it seems to simply
mean the opposite of "root" or "full_document". However, this PR does
not touch it.
2023-09-22 12:51:51 +01:00
zeertzjq
b7763d7f6b
fix(api): get virtual text with multiple hl properly (#25307) 2023-09-22 17:56:05 +08:00
zeertzjq
64e8a3c4d1
fix(ui): handle virtual text with multiple hl in more cases (#25304) 2023-09-22 15:36:24 +08:00
zeertzjq
34a786bc49
fix(extmarks): inline virt_text support multiple hl groups (#25303) 2023-09-22 14:21:58 +08:00
zeertzjq
6555176f34
vim-patch:9.0.1923: curswant wrong on click with 've' and 'nowrap' set (#25293)
Problem:  curswant wrong on click with 've' and 'nowrap' set
Solution: Add w_leftcol to mouse click column.

closes: vim/vim#13142

db54e989b5
2023-09-22 05:44:45 +08:00
Sergey Slipchenko
345bd91db2
fix(lsp): handle absence of a trailing newline #25194
Fixes #24339

rust-analyzer sends "Invalid offset" error in such cases. Some other
servers handle it specially.

LSP spec mentions that "A range is comparable to a selection in an
editor". Most editors don't handle trailing newlines the same way
Neovim/Vim does, it's clearly visible if it's present or not. With that
in mind it's understandable why sending end position as simply the start
of the line after the last one is considered invalid in such cases.
2023-09-21 03:06:40 -07:00
bfredl
f246cf029f
Merge pull request #25270 from bfredl/indeterminism
fix(test): fix "indeterminism" warnings in UI tests
2023-09-21 09:36:41 +02:00
zeertzjq
e25cf47ad3 fix(mouse): click on empty line with 'foldcolumn' 2023-09-21 11:13:48 +08:00
zeertzjq
acc32f20be test(ui/float_spec): click in bordered float sets correct curswant 2023-09-21 09:55:47 +08:00
zeertzjq
adb73772d9 vim-patch:9.0.1919: Wrong curswant when clicking on empty line or with vsplits
Problem:  Wrong curswant when clicking on empty line or with vsplits.
Solution: Don't check for ScreenCols[] before the start of the window
          and handle empty line properly.

closes: vim/vim#13132

03cd697d63
2023-09-21 09:43:12 +08:00
zeertzjq
f094db0e5c
vim-patch:9.0.1921: not possible to use the jumplist like a stack (#25278)
Problem:  not possible to use the jumplist like a stack
Solution: Add the 'jumpoptions' setting to make the jumplist
          a stack.

Add an option for using jumplist like tag stack

related: vim/vim#7738
closes: vim/vim#13134

ported from NeoVim:

- https://neovim.io/doc/user/motion.html#jumplist-stack
- neovim/neovim@39094b3
- https://vi.stackexchange.com/questions/18344/how-to-change-jumplist-behavior

Based on the feedback in the previous PR, it looks like many people like
this option.

87018255e3

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Co-authored-by: butwerenotthereyet <58348703+butwerenotthereyet@users.noreply.github.com>
2023-09-21 07:37:03 +08:00
zeertzjq
dc6c11394b
fix(statuscolumn): update number hl for each screen line (#25277) 2023-09-21 07:03:26 +08:00
Christian Clason
473d0aa3e6 vim-patch:9.0.1918
patch 9.0.1918: No filetype detection for Authzed filetypes

Problem:  No filetype detection for Authzed filetypes
Solution: Detect the *.zed file extension as authzed filetype

closes: vim/vim#13129

5790a54166

Co-authored-by: Matt Polzin <mpolzin@workwithopal.com>
2023-09-21 00:32:35 +02:00
bfredl
380b634ac9 fix(test): fix "indeterminism" warnings in UI tests 2023-09-20 21:51:57 +02:00
Ibby
23c21e7630
fix(extmarks): account for rightleft when drawing virt text (#25262)
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2023-09-20 22:39:54 +08:00
zeertzjq
818d7f6daf
fix(extmarks): fix win_col virt_text drawn on wrong screen line (#25264) 2023-09-20 21:48:12 +08:00
bfredl
acde86d436
Merge pull request #25096 from glepnir/float_winnew
fix(float): trigger winnew event when float window create
2023-09-20 09:25:59 +02:00
bfredl
c6cc56d69c
Merge pull request #25155 from glepnir/fix_winhl
fix(highlight): winhl receive wrong argument
2023-09-20 09:18:59 +02:00
Maria José Solano
b2265bb72c test(lsp): add normalize_markdown tests 2023-09-20 07:00:52 +01:00
zeertzjq
c4f4c7a356
vim-patch:9.0.1915: r_CTRL-C works differently in visual mode (#25248)
Problem:  r_CTRL-C works differently in visual mode
Solution: Make r_CTRL-C behave consistent in visual mode
          in terminal and Windows GUI

in visual mode, r CTRL-C behaves strange in Unix like environments. It
seems to end visual mode, but still is waiting for few more chars,
however it never seems to replace it by any characters and eventually
just returns back into normal mode.

In contrast in Windows GUI mode, r_CTRL-C replaces in the selected area
all characters by a literal CTRL-C.

Not sure why it behaves like this. It seems in the Windows GUI, got_int
is not set and therefore behaves as if any other normal character has
been pressed.

So remove the special casing of what happens when got_int is set and
make it always behave like in Windows GUI mode. Add a test to verify it
always behaves like replacing in the selected area each selected
character by a literal CTRL-C.

closes: vim/vim#13091
closes: vim/vim#13112

476733f3d0

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-09-20 06:37:29 +08:00
Maria José Solano
cfd4a9dfaf feat(lsp): use treesitter for stylize markdown 2023-09-19 14:47:37 +01:00
zeertzjq
c5abf487f1
fix(float): make "fixed" work with relative=win (#25243) 2023-09-19 18:45:11 +08:00
glepnir
437ed3cee2 fix(float): trigger winnew event when float window create 2023-09-19 18:44:48 +08:00
bfredl
1db45a9c1f
Merge pull request #25214 from bfredl/glyphcache
refactor(grid): change schar_T representation to be more compact
2023-09-19 12:32:41 +02:00
glepnir
ab92575753 fix(highlight): winhl receive wrong argument 2023-09-19 18:05:59 +08:00
bfredl
2de5cddeb1
Merge pull request #25148 from glepnir/fixed_opt
fix(float): add fixed option
2023-09-19 11:49:59 +02:00
bfredl
8da986ea87 refactor(grid): change schar_T representation to be more compact
Previously, a screen cell would occupy 28+4=32 bytes per cell
as we always made space for up to MAX_MCO+1 codepoints in a cell.

As an example, even a pretty modest 50*80 screen would consume

50*80*2*32 = 256000, i e a quarter megabyte

With the factor of two due to the TUI side buffer, and even more when
using msg_grid and/or ext_multigrid.

This instead stores a 4-byte union of either:
- a valid UTF-8 sequence up to 4 bytes
- an escape char which is invalid UTF-8 (0xFF) plus a 24-bit index to a
  glyph cache

This avoids allocating space for huge composed glyphs _upfront_, while
still keeping rendering such glyphs reasonably fast (1 hash table lookup
+ one plain index lookup). If the same large glyphs are using repeatedly
on the screen, this is still a net reduction of memory/cache
consumption. The only case which really gets worse is if you blast
the screen full with crazy emojis and zalgo text and even this case
only leads to 4 extra bytes per char.

When only <= 4-byte glyphs are used, plus the 4-byte attribute code,
i e 8 bytes in total there is a factor of four reduction of memory use.
Memory which will be quite hot in cache as the screen buffer is scanned
over in win_line() buffer text drawing

A slight complication is that the representation depends on host byte
order. I've tested this manually by compling and running this
in qemu-s390x and it works fine. We might add a qemu based solution
to CI at some point.
2023-09-19 11:25:31 +02:00
Sergey Slipchenko
46402c16c0
docs(test): add more info on debugging with gdb #25230 2023-09-18 05:24:18 -07:00
glepnir
fd08fd3de3 fix(float): add fixd option 2023-09-18 18:21:14 +08:00
zeertzjq
9cadbf1d36
test(tui_spec): update cursor_address test for wrap flag (#25228) 2023-09-18 12:16:32 +08:00
zeertzjq
508dda0e6c
test(ui/fold_spec): more testing for clicking on 'foldcolumn' (#25225) 2023-09-18 07:07:54 +08:00
Christian Clason
ed45aa835c vim-patch:9.0.1907: No support for liquidsoap filetypes
Problem:  No support for liquidsoap filetypes
Solution: Add liquidsoap filetype detection code

closes: vim/vim#13111

6b5efcdd8e

Co-authored-by: Romain Beauxis <toots@rastageeks.org>
2023-09-17 22:26:10 +02:00
zeertzjq
f54677132b
test(ui/fold_spec): click on multibyte "foldclosed" (#25216) 2023-09-17 21:31:51 +08:00
zeertzjq
71530cc972
feat(folds): support virtual text format for 'foldtext' (#25209)
Co-authored-by: Lewis Russell <lewis6991@gmail.com>
2023-09-17 20:29:18 +08:00
bfredl
a0c99755b8
Merge pull request #25190 from glepnir/echo_hl
fix(highlight): correct hi command output
2023-09-17 12:23:22 +02:00
glepnir
5183651773 fix(highlight): correct hi command output 2023-09-17 17:47:51 +08:00
Phelipe Teles
4ab9c5fa46
fix(lua): not using global value in vim.opt_global (#25196) 2023-09-17 06:35:12 +08:00