19134 Commits

Author SHA1 Message Date
ce0c0c31a0 fix(display): scroll logic does not take into account concealed topline (#33054) 2025-03-27 12:51:57 +01:00
424d30fe97 fix(ui): send multigrid message position and size when the UI is refreshed 2025-03-27 18:41:57 +07:00
750e1836af vim-patch:9.1.1224: cannot :put while keeping indent (#33076)
Problem:  cannot :put while keeping indent (Peter Aronoff)
Solution: add the :iput ex command (64-bitman)

fixes: vim/vim#16225
closes: vim/vim#16886

e08f10a55c

Cherry-pick test_put.vim changes from patch 8.2.1593.

N/A patches:
vim-patch:9.1.1213: cannot :put while keeping indent
vim-patch:9.1.1215: Patch 9.1.1213 has some issues

Co-authored-by: 64-bitman <60551350+64-bitman@users.noreply.github.com>
Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
2025-03-27 01:06:46 +00:00
797195e0ea vim-patch:9.1.1219: Strange error with wrong type for matchfuzzy() "camelcase"
Problem:  Strange error with type for matchfuzzy() "camelcase".
Solution: Show the error "Invalid value for argument camelcase" instead
          of "Invalid argument: camelcase" (zeertzjq).

Note that using tv_get_string() will lead to confusion, as when the
value cannot be converted to a string tv_get_string() will also give an
error about that, but "camelcase" takes a boolean, not a string.  Also
don't use tv_get_string() for the "limit" argument above.

closes: vim/vim#16926

c4815c157b
2025-03-27 08:25:12 +08:00
162edf7b30 vim-patch:9.1.1214: matchfuzzy() can be improved for camel case matches
Problem:  When searching for "Cur", CamelCase matches like "lCursor" score
          higher than exact prefix matches like Cursor, which is
          counter-intuitive (Maxim Kim).
Solution: Add a 'camelcase' option to matchfuzzy() that lets users disable
          CamelCase bonuses when needed, making prefix matches rank higher.
          (glepnir)

fixes: vim/vim#16504
closes: vim/vim#16797

28e40a7b55

Co-authored-by: glepnir <glephunter@gmail.com>
2025-03-27 08:19:25 +08:00
0af780e8df vim-patch:9.1.1228: completion: current position column wrong after got a match
Problem:  The current_pos.col was incorrectly updated to the length of
          the matching text. This will cause the next search to start
          from the wrong position.
Solution: current_pos has already been updated in search_str_in_line and
          does not need to be changed (glepnir)

closes: vim/vim#16941

5753084042

Co-authored-by: glepnir <glephunter@gmail.com>
2025-03-27 07:26:42 +08:00
e39cdafed9 vim-patch:9.1.1201: 'completefuzzycollect' does not handle dictionary correctly
Problem:  'completefuzzycollect' does not handle dictionary correctly
Solution: check for ctrl_x_mode_dictionary (glepnir)

closes: vim/vim#16867

587601671c

Cherry-pick a documentation fix from later.

Co-authored-by: glepnir <glephunter@gmail.com>
2025-03-27 07:26:42 +08:00
5975ddbdb8 vim-patch:1dc731a: runtime(doc): make :h 'completefuzzycollect' a bit clearer
- Fix grammar
- Use "matches" instead of "items" ("completion candidates" is used in
  some other places, but it's a bit verbose)
- "When set" is a bit vague, instead use "For specified modes"

closes: vim/vim#16871

1dc731a49f
2025-03-27 07:26:42 +08:00
28f6199474 vim-patch:9.1.1197: process_next_cpt_value() uses wrong condition
Problem:  process_next_cpt_value() uses wrong condition
Solution: use cfc_has_mode() instead and remove redundant else if branch
          (glepnir)

closes: vim/vim#16833

53b14578e0

Co-authored-by: glepnir <glephunter@gmail.com>
2025-03-27 07:26:42 +08:00
cd95ea5d48 vim-patch:9.1.1185: endless loop with completefuzzycollect and no match found
Problem:  endless loop with completefuzzycollect and no match found
Solution: move pointer to line end and break loop

closes: vim/vim#16820

dd42b05f8a

Co-authored-by: glepnir <glephunter@gmail.com>
2025-03-27 07:26:42 +08:00
10fde593f1 vim-patch:9.1.1182: No cmdline completion for 'completefuzzycollect'
Problem:  No cmdline completion for the 'completefuzzycollect' option
          (after v9.1.1178)
Solution: Add cmdline completion for the 'completefuzzycollect' option,
          improve its description in optwin.vim (zeertzjq).

closes: vim/vim#16813

53d59ecc1d

No code change is needed in Nvim as Nvim uses expand_set_str_generic()
by default.
2025-03-27 07:26:42 +08:00
17db70f3af vim-patch:9.1.1181: Unnecessary STRLEN() calls in insexpand.c
Problem:  Unnecessary STRLEN() calls in insexpand.c (after 9.1.1178).
Solution: Use the already available length (zeertzjq).

closes: vim/vim#16814

4422de6316
2025-03-27 07:26:42 +08:00
90d59e6c8a vim-patch:9.1.1178: not possible to generate completion candidates using fuzzy matching
Problem:  not possible to generate completion candidates using fuzzy
          matching
Solution: add the 'completefuzzycollect' option for (some) ins-completion
          modes (glepnir)

fixes vim/vim#15296
fixes vim/vim#15295
fixes vim/vim#15294
closes: vim/vim#16032

f31cfa29bf

Co-authored-by: glepnir <glephunter@gmail.com>
2025-03-27 07:26:42 +08:00
3029357520 vim-patch:9.1.1131: potential out-of-memory issue in search.c
Problem:  potential out-of-memory issue in search.c
Solution: improve situation and refactor search.c slightly
          (John Marriott)

- In function update_search_stat():
  add a check for a theoretical null pointer reference, set and remember
  the length of lastpat, remove the three calls to STRLEN() and use the
  various string's associated lengths instead, add a check for an
  out-of-memory condition.

- In function search_for_fuzz_match():
  remove a call to strnsave() and thus avoid having to add a check for
  an out-of-memory condition, also replace the call to STRLEN() by
  ml_get_buf_len().

closes: vim/vim#16689

b79fa3d9c8

Co-authored-by: John Marriott <basilisk@internode.on.net>
2025-03-27 07:26:42 +08:00
fbac254511 vim-patch:9.1.0733: keyword completion does not work with fuzzy
Problem:  keyword completion does not work with fuzzy
          (egesip)
Solution: handle ctrl_x_mode_normal() specifically
          (glepnir)

fixes: vim/vim#15412
closes: vim/vim#15424

7cfe693f9b

Co-authored-by: glepnir <glephunter@gmail.com>
2025-03-27 07:26:42 +08:00
bf62672d59 vim-patch:26e4b00: runtime(doc): Revert outdated comment in completeopt's fuzzy documentation
Originally, `:set completeopt+=fuzzy` did not affect how the candidate
list is collected in default keyword completion. A comment was added to
documentation as part of vim/vim#14912 to clarify it. vim/vim#15193 later changed the
fuzzy behavior to now change the candidate collection behavior as well
so the clarification in docs is now wrong. Remove them here.

closes: vim/vim#15656

26e4b00002

Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2025-03-27 07:26:42 +08:00
767a52ba30 vim-patch:9.1.0705: Sorting of fuzzy filename completion is not stable
Problem:  Sorting of fuzzy filename completion is not stable
Solution: Compare indexes when scores are equal.  Fix some typos.
          (zeertzjq)

closes: vim/vim#15593

58d705238c
2025-03-27 07:26:42 +08:00
f4ddbaeb9e vim-patch:9.1.0654: completion does not respect completeslash with fuzzy
Problem:  completion does not respect completeslash with fuzzy
          (egesip)
Solution: Change path separator on Windows, depending on 'completeslash'
          option value (glepnir)

fixes: vim/vim#15392
closes: vim/vim#15418

b9de1a057f

Co-authored-by: glepnir <glephunter@gmail.com>
2025-03-27 07:26:42 +08:00
d9f4c1db23 vim-patch:9.1.0634: Ctrl-P not working by default
Problem:  Ctrl-P not working by default
          (Jesse Pavel, after v9.1.0598)
Solution: Revert part of v9.1.0598 and set cur_match_pos
          correctly according to compl_dir_forward()

fixes: vim/vim#15370
closes: vim/vim#15379

13032a49b7

Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-03-27 07:26:42 +08:00
9757b11aaf vim-patch:9.1.0631: wrong completion list displayed with non-existing dir + fuzzy completion
Problem:  wrong completion list displayed with non-existing dir + fuzzy
          completion (kawarimidoll)
Solution: clear list of matches, if leader did not use fuzzy match
          (glepnir)

fixes: vim/vim#15357
closes: vim/vim#15365

6b6280c4a2

Co-authored-by: glepnir <glephunter@gmail.com>
2025-03-27 07:26:42 +08:00
a9aedfbc58 vim-patch:9.1.0605: internal error with fuzzy completion
Problem:  internal error with fuzzy completion
          (techntools)
Solution: only fuzzy complete the pattern after directory separator
          (glepnir)

fixes: vim/vim#15287
closes: vim/vim#15291

0be03e14b9

Co-authored-by: glepnir <glephunter@gmail.com>
2025-03-27 07:26:42 +08:00
d5a6040967 vim-patch:9.1.0598: fuzzy completion does not work with default completion
Problem:  fuzzy completion does not work with default completion
Solution: Make it work (glepnir)

closes: vim/vim#15193

8159fb18a9

Cherry-pick insexpand.c changes from patch 9.1.0608.

N/A patch:
vim-patch:9.1.0632: MS-Windows: Compiler Warnings

Co-authored-by: glepnir <glephunter@gmail.com>
2025-03-27 07:26:41 +08:00
c5f3b4ca02 revert: "refactor(tui): disable kitty key event reporting"
This reverts commit 466f20dd70.
2025-03-26 17:23:53 +01:00
8a7e1b19b9 docs: news, lsp autocomplete #33047 2025-03-26 05:49:48 -07:00
a3b4743b43 vim-patch:9.1.1238: wrong cursor column with 'set splitkeep=screen' (#33060)
Problem:  With ':set splitkeep=screen', cursor did't restore column
          correctly when splitting a window on a line longer than the
          last line on the screen (after v9.1.0707)
Solution: Restore cursor column in `win_fix_scroll()` since it may be
          changed in `getvcol()` after 396fd1ec2956 (phanium).

Example:
```
echo longlonglongling\nshort | vim - -u NONE --cmd 'set
splitkeep=screen' +'norm $' +new +q
```

fixes: vim/vim#16968
closes: vim/vim#16971

7746348c5d

Co-authored-by: phanium <91544758+phanen@users.noreply.github.com>
2025-03-26 06:58:36 +08:00
d32780de4d fix(mswin): UI may hang on exit
Problem:
On Windows, since b360c06085, UI may hang on exit. #33019

Solution:
Restore the hack in on_proc_exit, until we can figure out why rpc_close
is not called in the UI client when the server closes the channel.
2025-03-25 15:14:28 +01:00
c49162be59 fix(channel): log after (not before) channel-close
Problem:
chan_close_on_err() writes to the log file before peforming its actual
work. This could be slightly misleading in terms of log timestamps, or
could delay important work on Windows where file-open/write can be slow.

Solution:
Log after closing the channel, instead of before.
2025-03-24 17:48:19 +01:00
e73a3f1edc refactor(channel): redundant channel_close()
Problem:
`receive_msgpack()` calls `channel_close()` just before calling
`chan_close_on_err()`, even though `chan_close_on_err()` always calls
`channel_close()`.

Solution:
Remove the redunant `channel_close()` in `receive_msgpack()`.
2025-03-24 17:38:34 +01:00
c908c2560d fix(log): unify error messages for vim.ui_attach/decor providers #33005
Problem:  Error messages that cause a vim.ui_attach() namespace to
          detach are not visible in the message history. Decoration
          provider and vim.ui_attach error messages are dissimilar.
Solution: Emit vim.ui_attach() errors as an actual message in addition
          to logging it. Adjust error message format.
2025-03-21 03:05:01 -07:00
175c09bd66 vim-patch:9.1.1226: "shellcmdline" completion doesn't work with input() (#32998)
Problem:  "shellcmdline" completion doesn't work with input().
Solution: Use set_context_for_wildcard_arg().  Fix indent in nextwild()
          (zeertzjq).

There are some other inconsistencies for input() completion (ref vim/vim#948),
but since "shellcmdline" currently doesn't work at all, it makse sense
to at least make it work.

fixes: vim/vim#16932
closes: vim/vim#16934

7a5115ce50
2025-03-20 07:21:17 +08:00
51853b82bc fix(messages): incorrect error message splitting and kind #32990
Problem:  Message kind logic for emitting an error message is convoluted
          and still results in emitting an unfinished message earlier than
          wanted.
Solution: Ensure emsg_multiline() always sets the kind wanted by the caller
          and doesn't isn't unset to logic for emitting the source message.
          Caller is responsible for making sure multiple message chunks are
          not emitted as multiple events by setting `msg_ext_skip_flush`...
2025-03-19 11:04:08 -07:00
42db8b1759 fix(path): crash with nvim_get_runtime_file during wildcard expansion (#32992)
Problem:  Crash with nvim_get_runtime_file during wildcard expansion.
Solution: Ensure recursive gen_expand_wildcards() is allowed when
          calling os_breakcheck()
2025-03-19 22:36:08 +08:00
0e59f6f4c7 fix(api): don't use 'winborder' when reconfiguring float (#32984)
Problem: Reconfiguring a float window applies the global 'winborder'.
Solution:
- Ignore 'winborder' when reconfiguring a float window.
- Still apply 'winborder' when converting a split to a float window.
2025-03-19 12:16:20 +00:00
d6653e1cc9 fix(marks): ensure decor is removed with proper range (#32973)
Problem:  Paired mark whose end is in front of its start should not have
          its decor removed (as fixed by 72f630f9), but may still need to
          have its range redrawn.
Solution: Still call `buf_decor_remove()` but ensure it is not called with
          an inverse range when `extmark_del()` is called on an end mark.
2025-03-19 10:00:42 +00:00
63bbb7c109 fix(api): fix 'winborder' preventing splits with nvim_open_win (#32981)
While at it, rename the p_winbd variable to p_winborder, as 'winbd' is
not the option's short name.

Co-authored-by: glepnir <glephunter@gmail.com>
2025-03-19 07:28:24 +00:00
190d0241e2 fix(options): fix 'winborder' accepting multiple string values (#32978)
Problem:  'winborder' accepting multiple string values.
Solution: Use the fallback did_set_str_generic() callback instead of
          did_set_winborder() which calls opt_strings_flags() with
          incorrect last argument.
2025-03-19 14:17:53 +08:00
430d12a4fd vim-patch:9.1.1221: Wrong cursor pos when leaving Insert mode just after 'autoindent' (#32976)
Problem:  Wrong cursor position and '^' mark when leaving Insert mode
          just after 'autoindent' and cursor on last char of line.
Solution: Don't move cursor to NUL when it wasn't moved to the left
          (zeertzjq).

fixes: vim/vim#15581
related: neovim/neovim#30165 neovim/neovim#32943
closes: vim/vim#16922

a3a7d10bfb
2025-03-18 23:34:02 +00:00
4d83649d10 vim-patch:9.1.1222: using wrong length for last inserted string (#32975)
Problem:  using wrong length for last inserted string
          (Christ van Willegen, after v9.1.1212)
Solution: use the correct length in get_last_insert_save(), make
          get_last_insert() return a string_T (John Marriott)

closes: vim/vim#16921

8ac0f73eb1

N/A patches:
vim-patch:9.1.1129: missing out-of-memory test in buf_write()
vim-patch:9.1.1218: missing out-of-memory check in filepath.c

Co-authored-by: John Marriott <basilisk@internode.on.net>
2025-03-19 07:08:39 +08:00
62d9fab9af feat(float): add winborder option (#31074)
Problem:
There is currently no global option to define the default border style for floating windows. This leads to repetitive code when developers need consistent styling across multiple floating windows.

Solution:
Introduce a global option winborder to specify the default border style for floating windows. When a floating window is created without explicitly specifying a border style, the value of the winborder option will be used. This simplifies configuration and ensures consistency in floating window appearance.

Co-authored-by: Gregory Anders <greg@gpanders.com>
2025-03-18 16:05:35 -05:00
7333c39e6c docs: misc #32959 2025-03-18 06:18:37 -07:00
d717f8605a vim-patch:9.1.1216: Pasting the '.' register multiple times may not work
Problem:  Pasting the '.' register multiple times may work incorrectly
          when the last insert starts with Ctrl-D and ends with '0'.
          (after 9.1.1212)
Solution: Restore the missing assignment (zeertzjq).

closes: vim/vim#16908

61b3544424
2025-03-18 06:12:40 +08:00
59d8d50c5b vim-patch:3495497: patch 9.1.1212: too many strlen() calls in edit.c
Problem:  too many strlen() calls in edit.c
Solution: refactor edit.c and remove strlen() calls
          (John Marriott)

This commit attempts to make edit.c more efficient by:

- in truncate_spaces() pass in the length of the string.
- return a string_T from get_last_insert(), so that the length of the
  string is available to the caller.
- refactor stuff_insert():

  - replace calls to stuffReadbuff() (which calls STRLEN() on it's
    string argument) with stuffReadbuffLen() (which gets the length of
    it's string argument passed in).
  - replace call to vim_strrchr() which searches from the start of the
    string with a loop which searches from end of the string to find the
    last ESC character.

- change get_last_insert_save() to call get_last_insert() to get the
  last_insert string (the logic is in one place).

closes: vim/vim#16863

34954972c2

Co-authored-by: John Marriott <basilisk@internode.on.net>
2025-03-18 06:12:29 +08:00
063b69bab4 fix(column): unnecessary redraws with resized 'statuscolumn' (#32944)
Problem:  Since 3cb1e825, all windows with 'statuscolumn' set, and a
          resized 'signcolumn' for a particular buffer are marked
          to be fully redrawn when the first window is encountered.
          The "resized" variable is only unset after all windows have
          been drawn, so this results in windows that have just been
          draw to be marked for redraw again, even though the
          signcolumn did not change size again.
Solution: Replace the `resized` variable with a `last_max` variable that
          is changed when the first window into buf is encountered.
2025-03-17 21:52:45 +01:00
f96606371c docs: misc 2025-03-17 12:31:53 +01:00
041a939eeb docs(api): rename "handle" => "id" 2025-03-17 12:06:38 +01:00
72f630f92d fix(marks): issues with invalid marks and marks beyond eob (#32862)
Problem:  Marks that go beyond the end of the buffer, and paired marks
          whose end is in front of its start mark are added to and
          removed from the decor. This results in incorrect tracking
          of the signcolumn.
Solution: Ensure such marks are not added to and removed from the decor.
2025-03-16 12:15:50 +01:00
466f20dd70 refactor(tui): disable kitty key event reporting
Temporary measure for the stable release. Re-enable for nightly after
0.11 release.
2025-03-16 12:03:45 +01:00
19fc65acbc fix(statuscolumn): misleading v:lnum for virtual lines #32912
Problem:  Virtual 'statuscolumn' lines are evaluated with a misleading v:(rel)num.
          Namely set to the line above for `virt_lines_above = true` lines, or even
          the last drawn line for a partial redraw.
Solution: Set `v:lnum` for the first evaluated row of a line, first above
          virtual line of a row and first non-virtual line of a row.
2025-03-15 08:18:23 -07:00
026cfa28d0 docs: misc
Co-authored-by: Au. <acehinnnqru@gmail.com>
Co-authored-by: Daniel Rainer <daniel.rainer@localhost>
Co-authored-by: Evgeni Chasnovski <evgeni.chasnovski@gmail.com>
Co-authored-by: Lewis Russell <lewis6991@gmail.com>
Co-authored-by: Luuk van Baal <luukvbaal@gmail.com>
Co-authored-by: Pierre Barbin <pierre@heitzsystem.com>
Co-authored-by: Riley Bruins <ribru17@hotmail.com>
Co-authored-by: Yinzuo Jiang <jiangyinzuo@foxmail.com>
Co-authored-by: phanium <91544758+phanen@users.noreply.github.com>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2025-03-15 15:00:44 +01:00
4662ad5643 feat(defaults): completeopt=popup #32909
Assuming that completeopt=popup does what its documentation claims, it
is more appropriate that completeopt=preview as a default.
2025-03-15 13:07:21 +00:00