Commit Graph

7526 Commits

Author SHA1 Message Date
zeertzjq
1db1476fd9
vim-patch:9.1.0512: Mode message for spell completion doesn't match allowed keys (#29437)
Problem:  Mode message for spell completion doesn't match allowed keys
          (Kyle Kovacs)
Solution: Show "^S" instead of "s".
          (zeertzjq)

This matches the code in vim_is_ctrl_x_key():

	case CTRL_X_SPELL:
	    return (c == Ctrl_S || c == Ctrl_P || c == Ctrl_N);

fixes: neovim/neovim#29431
closes: vim/vim#15065

7002c055d5
2024-06-21 14:40:28 +08:00
zeertzjq
f45403db19 vim-patch:9.1.0511: CursorMovedC triggered wrongly with setcmdpos()
Problem:  CursorMovedC triggered wrongly with setcmdpos()
          (after v9.1.0507)
Solution: Remove the premature triggering.  Also don't trigger when
          cursor didn't move. (zeertzjq)

closes: vim/vim#15064

bc6f96708e
2024-06-21 14:13:33 +08:00
zeertzjq
86ea42ce26 vim-patch:9.1.0507: hard to detect cursor movement in the command line
Problem:  hard to detect cursor movement in the command line
Solution: Add the CursorMovedC autocommand
          (Shougo Matsushita)

closes: vim/vim#15040

d09521476f

Co-authored-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
2024-06-21 14:10:30 +08:00
Jaehwang Jung
0e3e1e6b6d
fix(treesitter): don't open fold when o/O adds a line below #28709
Problem:
`o`-ing on a folded line opens the fold, because the new line gets the
fold level from the above line (level '='), which extends the fold to
the new line. `O` has a similar problem when run on the line below a
fold.

Solution:
Use -1 for the added line to get the lower level from the above/below
line.
2024-06-20 06:37:09 -07:00
zeertzjq
af0021f990
vim-patch:9.1.0505: filetype: Faust files are not recognized (#29426)
Problem:  filetype: Faust files are not recognized
Solution: Detect '*.lib' files as Faust filetype, add detection for
          '*.dsp' files (Faust or Make), remove '*.lib' from Cobol
          filetype (PowerUser64)

closes: vim/vim#14894

aa61b8a908

Co-authored-by: PowerUser64 <blake@blakenorth.net>
2024-06-20 17:45:41 +08:00
zeertzjq
978b0263f8
Merge pull request #29413 from jiangyinzuo/vim-patch-9.1.0497
vim-patch:partial:9.1.{0497,0501}: termdebug can be further improved
2024-06-20 12:29:47 +08:00
Yinzuo Jiang
99373c8792 vim-patch:partial:9.1.0501: too complicated mapping restore in termdebug
Problem:  too complicated mapping restore in termdebug
Solution: simplify unmapping logic, add a few more tests
          (Ubaldo Tiberi)

closes: vim/vim#15046

46f2823807

Co-authored-by: Ubaldo Tiberi <ubaldo.tiberi@google.com>
2024-06-20 10:49:24 +08:00
zeertzjq
3317aa2f37
vim-patch:9.1.0504: inner-tag textobject confused about ">" in attributes (#29420)
Problem:  inner-tag textobject confused about ">" in attributes
Solution: Skip over quoted '>' when determining the start position

fixes: vim/vim#15043
closes: vim/vim#15049

ca7f93e6f3

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-06-20 09:57:00 +08:00
Yinzuo Jiang
b48192af37 vim-patch:partial:9.1.0497: termdebug can be further improved
Problem:  termdebug can be further improved
Solution: refactor save/restore, update docs,
          add a new save/restore test (Ubaldo Tiberi)

closes: vim/vim#15032

a48637c105

Co-authored-by: Ubaldo Tiberi <ubaldo.tiberi@google.com>
2024-06-19 21:23:21 +08:00
zeertzjq
b1c439cef6
fix(drawline): don't draw beyond end of window with 'rnu' (#29406) 2024-06-19 09:20:24 +08:00
zeertzjq
a2a3e8412e vim-patch:8.2.5047: CurSearch highlight is often wrong
Problem:    CurSearch highlight is often wrong.
Solution:   Remember the last highlighted position and redraw when needed.

368137aa52

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2024-06-19 08:02:29 +08:00
zeertzjq
a2d510e101
vim-patch:9.1.0499: MS-Windows: doesn't handle symlinks properly (#29400)
Problem:  MS-Windows: doesn't handle symlinks properly
          (Timothy Madden)
Solution: Implement lstat() on MS-Windows
          (author)

lstat() differs from stat() in how it handles symbolic links, the former
doesn't resolve the symlink while the latter does so.

Implement a simple yet effective fallback using Win32 APIs.

fixes vim/vim#14933
closes: vim/vim#15014

23c5ebeb95

Co-authored-by: LemonBoy <thatlemon@gmail.com>
Co-authored-by: K.Takata <kentkt@csc.jp>
2024-06-19 06:32:02 +08:00
luukvbaal
102971a396
fix(mouse): early return when clicking in padded 'statuscolumn' (#29394)
Problem:  Hit assert when clicking inside a padded 'statuscolumn' that
          is padded beyond the length of the allocated click_defs.
Solution: Still consider this a "in_statuscol" click, but return early
          when about to execute the click func.
2024-06-19 06:00:39 +08:00
zeertzjq
4e8ec4900e
vim-patch:9.1.0498: getcmdcompltype() interferes with cmdline completion (#29397)
Problem:  getcmdcompltype() interferes with cmdline completion.
Solution: Don't set expand context when it's already set.
          (zeertzjq)

closes: vim/vim#15036

a821b609f9
2024-06-19 05:47:25 +08:00
zeertzjq
b0c336eaf8
refactor(lua): remove unnecessary strlen() in nlua_expand_pat() (#29388)
Also change the initial value of `status` to `FAIL`, as that'll avoid
unnecessary assignments.
2024-06-18 12:02:31 +08:00
Rafael Kitover
1a1c766049
refactor: Windows tilde expansion followup (#29380)
Followup to #28515:

Rename the static os_homedir() to os_uv_homedir() to emphasize that it
is a wrapper around a libuv function.

Add the function os_get_homedir() to os/env.c to return the cached
homedir value as a const. Must be called after homedir is initialized or
it fails.

The difference between this function and the static os_uv_homedir() is
that the latter gets the homedir from libuv and is used to initialize
homedir in init_homedir(), while os_get_homedir() just returns homedir
as a const if it's initialized and is public.

Use the os_get_homedir() accessor for ~/ expansion on Windows to make
the code more concise.

Add a Windows section to main_spec.lua with tests for expanding ~/ and
~\ prefixes for files passed in on the command-line.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-06-18 11:23:52 +08:00
zeertzjq
948f2beed4
fix(lua): find length of completion prefix earlier (#29384)
Do the expansion right after setting the expand context, so that the
length of the completion prefix can be set, but don't do that directly
in set_one_cmd_context(), as that's also called by getcmdcompltype().
2024-06-18 09:47:10 +08:00
zeertzjq
c2491fbab4 vim-patch:9.1.0496: matched text is highlighted case-sensitively
Problem:  matched text is highlighted case-sensitively
Solution: use MB_STRNICMP, update highlighting when the base changes
          (glepnir)

fixes: vim/vim#15021
closes: vim/vim#15023

f189138b39

Co-authored-by: glepnir <glephunter@gmail.com>
2024-06-18 06:18:58 +08:00
zeertzjq
c429c5f86f vim-patch:9.1.0495: Matched text isn't highlighted in cmdline pum
Problem:  Matched text isn't highlighted in cmdline pum.
Solution: Use cmdline completion pattern in cmdline mode.
          (zeertzjq)

closes: vim/vim#15029

d8c9340fc6

Cherry-pick syntax.txt change from runtime update.
2024-06-18 06:18:34 +08:00
zeertzjq
20a7eebec0
vim-patch:9.1.0494: Wrong matched text highlighted in pum with 'rightleft' (#29371)
Problem:  Wrong matched text highlighted in pum with 'rightleft'.
Solution: Match using the original text instead of the reversed text.
          (zeertzjq)

closes: vim/vim#15020

63901e8963
2024-06-17 06:42:11 +08:00
zeertzjq
7746c54e10
Merge pull request #29357 from luukvbaal/statuscol
feat(column)!: rework 'statuscolumn' %r/l items
2024-06-17 06:33:15 +08:00
Luuk van Baal
ad70c9892d feat(column)!: rework 'statuscolumn' %r/l items
Problem:  A custom 'statuscolumn' needs to check a bunch of options and
          placed signs to replicate the default number column.
Solution: Rework %l item to include the necessary logic to mimic the
          default number column. Remove now redundant %r item.
2024-06-16 19:04:34 +02:00
Christian Clason
191a70f9dd vim-patch:9.1.0492: filetype: Vim-script files not detected by shebang line
Problem:  Vim-script files may not be recognised
Solution: Add shebang line detection (Doug Kearns)

closes: vim/vim#15012

0d4d23dac0

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2024-06-16 11:45:44 +02:00
zeertzjq
57c377dfb2
vim-patch:9.1.0493: Test for patch 9.1.0489 doesn't fail without the fix (#29366)
Problem:  Test for patch 9.1.0489 doesn't fail without the fix.
Solution: Use "!" flag of feedkeys() so that ex_normal_busy is not set
          and ins_compl_check_keys() is not skipped (zeertzjq).

closes: vim/vim#15018

acc8746941
2024-06-16 17:30:15 +08:00
zeertzjq
aa319da402
vim-patch:9.1.0489: default completion may break with fuzzy (#29364)
Problem:  default completion may break with fuzzy
Solution: check that completion_match_array is not null
          (glepnir)

closes: vim/vim#15010

aced8c2f4f

Co-authored-by: glepnir <glephunter@gmail.com>
2024-06-16 07:07:06 +08:00
zeertzjq
203540926d
vim-patch:9.1.0491: Cmdline pum doesn't work properly with 'rightleft' (#29355)
Problem:  Cmdline pum doesn't work properly with 'rightleft'.
Solution: Don't use curwin->w_p_rl in cmdline mode in pum_redraw().  Use
          a static variable since pum_may_redraw() may be called in any
          mode.  Also correct position of other popups with 'rightleft'.
          (zeertzjq)

closes: vim/vim#15005

883018feff
2024-06-15 22:37:48 +08:00
zeertzjq
fd2ef4edf9
vim-patch:9.1.0488: Wrong padding for pum "kind" with 'rightleft' (#29352)
Problem:  Wrong padding for pum "kind" with 'rightleft'.
Solution: Fix off-by-one error (zeertzjq).

The screen_fill() above is end-exclusive, and
- With 'rightleft' it fills `pum_col - pum_base_width - n + 1` to `col`,
  so the next `col` should be `pum_col - pum_base_width - n`.
- With 'norightleft' it fills `col` to `pum_col - pum_base_width + n - 1`,
  so the next `col` should be `pum_col - pum_base_width + n`.

closes: vim/vim#15004

a2324373eb
2024-06-15 21:39:56 +08:00
Christian Clason
4faad4a950 vim-patch:9.1.0486: filetype: Snakemake files are not recognized
Problem:  filetype: Snakemake files are not recognized
Solution: Detect '*.smk' and Snakefile files as snakemake filetype
          (Riley Bruins)

See:
https://snakemake.readthedocs.io/en/stable/snakefiles/deployment.html#distribution-and-reproducibility

closes: vim/vim#14992

82a579e15a

Co-authored-by: Riley Bruins <ribru17@hotmail.com>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2024-06-15 10:27:59 +02:00
Jerry
61aabe0730
fix(defaults): default @/Q broken when 'ignorecase' is set (#29343)
Problem:
When 'ignorecase' is set, the default keymap Q and Q would exit visual
mode.

This issue was raised in #28287 and a fix was applied in #28289.

However, `==` operator is subject to user `ignorecase` setting.

Solution:
Switching to `==#` operator would guarantee case sensitive comparison
between visual mode and linewise visual mode.

Co-authored-by: Kuanju Chen <kuanju.chen@mksinst.com>
2024-06-15 10:21:16 +08:00
zeertzjq
199d852d9f
vim-patch:9.1.0487: completed item not update on fuzzy completion (#29341)
Problem:  completed item not update on fuzzy completion
Solution: reset compl_shown_match when at original match position
          (glepnir)

closes: vim/vim#14955

f94c9c482a

Co-authored-by: glepnir <glephunter@gmail.com>
2024-06-15 07:20:38 +08:00
zeertzjq
aacd6c440d vim-patch:9.1.0485: Matched text shouldn't be highlighted in "kind" and "menu"
Problem:  Matched text shouldn't be highlighted in "kind" and "menu".
Solution: Pass hlf_T instead of the attribute.  Fix indent.
          (zeertzjq)

closes: vim/vim#14996

afbe5359e9
2024-06-15 04:58:11 +08:00
zeertzjq
dc4037f612 vim-patch:9.1.0476: Cannot see matched text in popup menu
Problem:  Cannot see matched text in popup menu
Solution: Introduce 2 new highlighting groups: PmenuMatch and
          PmenuMatchSel (glepnir)

closes: vim/vim#14694

40c1c3317d

Co-authored-by: glepnir <glephunter@gmail.com>
2024-06-15 04:47:23 +08:00
zeertzjq
fd950d4998
vim-patch:9.1.0484: Sorting of completeopt+=fuzzy is not stable (#29338)
Problem:  Sorting of completeopt+=fuzzy is not stable.
Solution: Compare original indexes when scores are the same.
          (zeertzjq)

closes: vim/vim#14988

8e56747fd2
2024-06-15 04:33:19 +08:00
Mathias Fußenegger
aa47af7e69
fix(lsp): tune completion word extraction for decorated labels (#29331)
Problem:

For snippets lsp.completion prefers the label if it is shorter than the
insertText or textEdit to support postfix completion cases but clangd
adds decoration characters to labels. E.g.: `•INT16_C(c)`

Solution:

Use parse_snippet on insertText/textEdit before checking if it is
shorter than the label.

Fixes https://github.com/neovim/neovim/issues/29301
2024-06-14 19:32:34 +02:00
Evgeni Chasnovski
458473acb8
fix(highlight): add StatusLineTerm/StatusLineTermNC to :color vim (#29313)
Problem: both `StatusLineTerm`/`StatusLineTermNC` are now explicitly
  used, but `:color vim` does not set them to the values used in Vim.
  This might be fine if `:color vim` is treated as "the state of default
  color scheme prior the big update", but it seems to be better treated
  as "Vim's default color scheme" (how it is documented in its header).

Solution: add `StatusLineTerm`/`StatusLineTermNC` definitions to
  'runtime/colors/vim.lua'.
  Use explicit foreground colors ('Whte'/'Black') instead of `guifg=bg`
  used in source, as the latter caused some problems in the past (if
  `Normal` is not defined, `nvim_set_hl()` can't recognize `'bg'` as the
  foreground value).
  Also realign the rest of the background conditional highlight groups.
2024-06-14 17:28:49 +08:00
Ilia Choly
0a9c81d709
refactor(lsp): use metatable for buf_versions (#29304)
This reduces the number of nil checks around buf_versions usage
Test changes were lifted from 5c33815

Co-authored-by: Mathias Fussenegger <f.mathias@zignar.net>
2024-06-14 11:03:58 +02:00
Yinzuo Jiang
29e05cfb7e
vim-patch:partial:9.1.0482: termdebug plugin needs more love (#29329)
Problem:  termdebug plugin needs more love
Solution: start with some more Vim9 refactoring
          to improve maintenance and readability
          (Ubaldo Tiberi)

List of Changes and the Reasoning Behind Them:

1) Introduction of InitScriptVariables() Function:

Reasoning: This function has been introduced to ensure that when you open and
close Termdebug, and then open it again, there are no leftover script variable
values from the previous session. Leftover values could potentially cause
issues. The goal is for each Termdebug session to be independent of previous
sessions. At startup, all script variables are initialized. The only exception
is g:termdebug_loaded located at the very beginning of the script to prevent
sourcing the script twice. The variables are declared at script level and
defined in InitScriptVariables().

2) More Descriptive Variable Names:

Reasoning: The names of variables have been made more comprehensive. Almost
every Termdebug buffer now has a variable to indicate its name and another
variable to indicate its number, improving code readability and
maintainability. Due to the latest discussion around the &mousemodel option
save/restore mechanism, perhaps some other variables shall be prepended with
saved_.

3) Consistent Naming for GDB Terminal Buffers:

Reasoning: The name of the GDB terminal buffer now matches the name of the GDB
program being used, e.g., 'gdb', 'mygdb', 'arm-eabi-none-gdb', etc. This
ensures clarity and consistency in identifying buffers.

4) Other minor improvements:
Moved EchoErr() on top, added another test, some refactoring, mainly changed
several 0 and 1 to true and false

closes: vim/vim#14980

ef8eab86e2

Co-authored-by: Ubaldo Tiberi <ubaldo.tiberi@volvo.com>
2024-06-14 16:37:38 +08:00
zeertzjq
5def8714ad
fix(terminal): set local values of window options (#29326) 2024-06-14 06:20:42 +08:00
zeertzjq
6b022f9d8b
vim-patch:9.1.0483: glob() not sufficiently tested (#29323)
Problem:  glob() not sufficiently tested
Solution: Add more tests for directory containing [] chars

related: vim/vim#14991

8b34aea1b0

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-06-14 05:48:23 +08:00
Gregory Anders
6311a7fe4b
Merge pull request #29103 from gpanders/test-no-tgc
test: do not set termguicolors in test runner
2024-06-12 19:31:15 -05:00
Lewis Russell
53afdf360c
Merge pull request #29303 from lewis6991/fix/wobuf
fix(vim.wo): never allow non-zero bufnr
2024-06-12 17:30:11 +01:00
Gregory Anders
d38912b59f refactor(terminal): move :terminal defaults to _defaults.lua 2024-06-12 10:43:57 -05:00
Gregory Anders
3e09fbdf82 feat(highlight): add StatusLineTerm and StatusLineTermNC groups
These highlight groups are used for the statusline in :terminal windows.
By default they link to StatusLine and StatusLineNC (respectively), so
there is no visual difference unless a colorscheme defines these groups
separately.
2024-06-12 10:43:57 -05:00
Lewis Russell
2ca678f57d test: fix vim.deprecate tests 2024-06-12 16:41:26 +01:00
Lewis Russell
8bf79bd13c fix(vim.wo): never allow non-zero bufnr 2024-06-12 15:42:56 +01:00
zeertzjq
033810ba23
vim-patch:9.1.0477: block_editing errors out when using <enter> (#29294)
Problem:  block_editing errors out when using <enter>
          (Ali Rizvi-Santiago, after v9.1.0274)
Solution: Change ins_len from size_t to int so that the test
          if ins_len is negative actually works properly

Add a test, so that this doesn't regress.

fixes: vim/vim#14960

1fb9eae579

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-06-12 11:07:36 +08:00
Gregory Anders
3ad977f01d
feat(terminal): add support for copying with OSC 52 in embedded terminal (#29117)
When libvterm receives the OSC 52 escape sequence it ignores it because
Nvim does not set any selection callbacks. Install selection callbacks
that forward to the clipboard provider, so that setting the clipboard
with OSC 52 in the embedded terminal writes to the system clipboard
using the configured clipboard provider.
2024-06-11 13:18:06 -05:00
Luuk van Baal
1dcda86559 fix(column): clamp line number for legacy signs
Problem:  Legacy :sign API still allows placing signs beyond the end of
          the buffer. This is unaccounted for by the signcolumn tracking
          logic and is disallowed in general for the extmark API which
          implements it now.
Solution: Clamp legacy sign line number to the length of the buffer.
2024-06-10 20:00:59 +02:00
Jon Huhn
4bd86120d4
fix(glob): handle overlapping {} condition elements #29236
This change fixes an issue where glob patterns like `{a,ab}` would not
match `ab` because the first option `a` matches, then the end of the
string is expected but `b` is found, and LPeg does not backtrack to try
the next option `ab` which would match. The fix here is to also append
the rest of the pattern to the generated LPeg pattern for each option.
This changes a glob `{a,ab}` from being parsed as

    ("a" or "ab") "end of string"

to

    ("a" "end of string" or "ab" "end of string")

Here, matching against `ab` would try the first option, fail to match,
then proceed to the next option, and match.

The sacrifice this change makes is dropping support for nested `{}`
conditions, which VSCode doesn't seem to support or test AFAICT.

Fixes #28931

Co-authored-by: Sergey Slipchenko <faergeek@gmail.com>
2024-06-10 04:23:03 -07:00
Tom Praschan
20f22f75ee
feat(lsp): include end_col, end_lnum in vim.lsp.buf.locations_to_items #29164 2024-06-09 18:14:55 -07:00