Commit Graph

28676 Commits

Author SHA1 Message Date
altermo
6c168c0f4d
docs: correct on_key docs (#27429) 2024-02-12 20:03:53 +08:00
bfredl
f1dd75c2af fix(exitfree): don't use ex commands to close windows in free_all_mem()
Attempting to manipulate the window layout via ex commands is not safe
here. It is also redundant: `win_free_all()` can free multiple windows
by itself perfectly fine.
2024-02-12 12:20:12 +01:00
Lewis Russell
917172dd96 fix(lsp): semantic token defer loading
Fixes #27424
2024-02-12 09:31:48 +00:00
Raphael
4682f158a0
vim-patch:9.1.0098: CompleteChanged not triggered when new leader added without matches (#27436)
Problem:  CompleteChanged not triggered when new leader added causing
          no matching item in the completion menu
Solution: When completion is active but no items matched still trigger
          CompleteChanged event
          (glepnir)

closes: vim/vim#13982

0d3c0a66a3

Fix #15077
2024-02-12 14:57:13 +08:00
zeertzjq
929e1b7f1c
perf(extmarks): avoid unnecessary invalidations for virt_text (#27435)
Invalidation of most w_valid flags isn't needed when adding or removing
virtual text below cursor.
2024-02-12 13:02:27 +08:00
zeertzjq
950a0ac61c
vim-patch:b614b284ee06 (#27433)
runtime(vim): Update syntax file (vim/vim#14009)

- allow comments after :highight commands
- match the bang in a :highlight[!] command
- highlight the bang in :map[!], :menu[!] and :unlet[!] with vimOper
  like all other commands

b614b284ee

Co-authored-by: dkearns <dougkearns@gmail.com>
2024-02-12 06:56:48 +08:00
luukvbaal
5a4e0b837f
fix(column): use a single path for sign sorting (#27431)
Problem:  #25826 added a (duplicate) sign comparison function, which was
modified and strayed from the original in #27418.
Solution: Merge the two functions and add a display test that actually
tests for this order in addition to the legacy tests.
2024-02-12 06:41:44 +08:00
zeertzjq
9605cfe06c
vim-patch:9.1.0097: 'breakindent' behaves inconsistently with 'list' and splits (#27432)
Problem:  'breakindent' behaves inconsistently with 'list' and splits.
Solution: Use 'listchars' from the correct window and handle caching
          properly. Move cheaper comparisons to the top.
          (zeertzjq)

closes: vim/vim#14008

efabd7c8d4
2024-02-12 06:34:16 +08:00
VanaIgr
3faedb0509
refactor(indent): refactor computing of a string's indent size (#27252)
The `get_indent_str_vtab()` function currently calls `tabstop_padding()`
every time a tab is encountered (unless tabstops aren't used).
`tabstop_padding()` either does a division by 'tabstop' If 'vartabstop'
is not set, or iterates through the 'vartabstop' list to find current
tab width. 

Since the virtual column only increases, we can keep track of where the
next tabstop would be, and update this information once it was reached.

`get_indent_str_vtab()` also depends on 'listchars' "tab" value from the
current window, even though it may be called for a line from the same
buffer in a different window. In most cases, it is called with tabstops
enabled (last argument was `false`), so I split the function into one
that uses tabstops and the other that doesn't.

I removed `get_indent_str()` since I couldn't find any calls to it.
2024-02-12 04:17:15 +08:00
Christian Clason
46390635cd vim-patch:6d91227267a5
runtime(gpg): Mark dangerous use-embedded-filename with WarningMsg

The syntax highlighter is likely to encourage people to use the listed
commands.

But `use-embedded-filename` is a dangerous option that can cause GnuPG
to write arbitrary data to arbitrary files whenever GnuPG encounters
malicious data.

GnuPG upstream explicitly warns against using this option:

https://dev.gnupg.org/T4500
https://dev.gnupg.org/T6972

However, since this is a valid option, we cannot just drop it from the
syntax script. Instead, let's mark it with the WarningMsg highlighting
to make it obvious, that this option is different (and should not be
used for security reasons).

closes: vim/vim#13961

6d91227267

Co-authored-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2024-02-11 20:09:43 +01:00
Lewis Russell
ed1b66bd99
refactor(lsp): move more code to client.lua
The dispatchers used by the RPC client should be defined in the client,
so they have been moved there. Due to this, it also made sense to move
all code related to client configuration and the creation of the RPC
client there too.

Now vim.lsp.start_client is significantly simplified and now mostly
contains logic for tracking open clients.

- Renamed client.new -> client.start
2024-02-11 12:37:20 +00:00
Lewis Russell
8e86193502
Merge pull request #27420 from MariaSolOs/warning-anxiety
refactor(lsp): fix type annotations and add shared diagnostic helper
2024-02-11 11:42:21 +00:00
bfredl
d48f75e42e
Merge pull request #27414 from bfredl/arenalines
refactor(api): use an arena for nvim_buf_get_lines and buffer updates
2024-02-11 12:00:55 +01:00
bfredl
930d6e38d4 refactor(api): use an arena for nvim_buf_get_lines and buffer updates
Refactor some earlier "temporary Array" code in buffer_updates.c to use
the modern style of MAXSIZE_TEMP_ARRAY and ADD_C
2024-02-11 11:37:55 +01:00
zeertzjq
ca258db156
fix(messages): clear new lines when increasing 'cmdheight' (#27421) 2024-02-11 18:12:56 +08:00
Maria José Solano
eac7e3fc6c refactor(lsp): add vim.lsp.sync.Range type 2024-02-10 20:05:47 -08:00
Maria José Solano
5a6868c888 refactor(lsp): add shared diagnostic handler 2024-02-10 20:05:47 -08:00
Maria José Solano
c73d67d283 refactor(lsp): add type annotations 2024-02-10 20:05:47 -08:00
Trevor Arjeski
170c890dca
feat(shortmess): "q" flag fully hides recording message (#27415)
When "q" is set in 'shortmess' it now fully hides the "recording @a" message
when you are recording a macro instead of just shortening to "recording". This
removes duplication when using reg_recording() in the statusline.

Related #19193
2024-02-11 07:39:39 +08:00
Will Hopkins
f1f8fa850f
refactor: rename w_float_config to w_config #27419
Follows up on rename of `FloatConfig` to `WinConfig` in #27397.
2024-02-10 13:06:01 -08:00
bfredl
320eec496c
Merge pull request #27253 from MariaSolOs/codelens-refresh
feat(lsp): add opts to vim.lsp.codelens.refresh
2024-02-10 21:48:45 +01:00
zeertzjq
470c450fd2
Merge pull request #27418 from zeertzjq/vim-9.1.0089
vim-patch:9.1.{0089,0093}: qsort() comparison function fixes
2024-02-10 22:19:51 +08:00
zeertzjq
00e785b17f refactor: don't use subtraction in qsort() comparison functions 2024-02-10 21:55:57 +08:00
zeertzjq
f3982ad3f3 vim-patch:9.1.0093: Still a qsort() comparison function that returns result of subtraction
Problem:  Still a qsort() comparison function fuzzy_match_item_compare()
          that returns result of subtraction (after 9.1.0089).
Solution: Use an explicit comparison instead of subtraction.
          (zeertzjq)

closes: vim/vim#14004

77078276bf
2024-02-10 21:55:54 +08:00
zeertzjq
5bbb733a1b vim-patch:9.1.0089: qsort() comparison functions should be transitive
Problem:  qsort() comparison functions should be transitive
Solution: Do not subtract values, but rather use explicit comparisons

Improve qsort() comparison functions

There has been a recent report on qsort() causing out-of-bounds read &
write in glibc for non transitive comparison functions
https://www.qualys.com/2024/01/30/qsort.txt

Even so the bug is in glibc's implementation of the qsort() algorithm,
it's bad style to just use substraction for the comparison functions,
which may cause overflow issues and as hinted at in OpenBSD's manual
page for qsort(): "It is almost always an error to use subtraction to
compute the return value of the comparison function."

So check the qsort() comparison functions and change them to be safe.

closes: vim/vim#13980

e06e437665

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-02-10 21:55:51 +08:00
Christian Clason
71429c90ee build(deps): bump tree-sitter-bash to v0.20.5 2024-02-10 14:49:09 +01:00
Justin M. Keyes
e15dfb5f79
refactor: reduce some globals #27406 2024-02-10 05:00:17 -08:00
bfredl
607606e3bb
Merge pull request #27398 from bfredl/arena2
refactor(api): use arena for more stuff
2024-02-10 12:07:37 +01:00
zeertzjq
4948fa42ef
test(ui/mouse_spec): make sure click is processed (#27412) 2024-02-10 12:57:40 +08:00
Raphael
7ab003ec79
vim-patch:9.1.0087: Restoring lastused_tabpage too early in do_arg_all() (#27411)
Problem:  Restore lastused_tabpage too early in do_arg_all() function it
          will change later in the function.
Solution: Restore lastused_tabpage a bit later, when being done with
          tabpages (glepnir)

closes: vim/vim#13992

2975a54f28
2024-02-10 12:21:31 +08:00
zeertzjq
ba23d109ba
test: add test for scroll wheel at right-click menu (#27409) 2024-02-10 11:54:26 +08:00
zeertzjq
dcb11c1091
build(clint): don't allow INIT() in non-header files (#27407) 2024-02-10 11:11:30 +08:00
Pablo Arias
8e739af064
fix(startup): multiprocess startuptime #26790
Problem:
Since 2448816956, the --startuptime report shows
two blocks of data. The TUI process and its embedded nvim process write to the
file concurrently, which may interleave the two startup sequences into the same
timeline.

Solution:
Report each process as a separate section in the same file.
1. Each process buffers the full report.
2. After startup is finished, the buffer is flushed (appended) to the file.

Fix #23036
Sample report:

    --- Startup times for process: Primary/TUI ---

    times in msec
     clock   self+sourced   self:  sourced script
     clock   elapsed:              other lines

    000.006  000.006: --- NVIM STARTING ---
    000.428  000.422: event init
    000.728  000.301: early init
    ...
    005.880  000.713: init highlight
    005.882  000.002: --- NVIM STARTED ---

    --- Startup times for process: Embedded ---

    times in msec
     clock   self+sourced   self:  sourced script
     clock   elapsed:              other lines

    000.006  000.006: --- NVIM STARTING ---
    000.409  000.403: event init
    000.557  000.148: early init
    000.633  000.077: locale set
    ...
    014.383  000.430: first screen update
    014.387  000.003: --- NVIM STARTED ---
2024-02-09 14:56:52 -08:00
zeertzjq
3f419d84fb
vim-patch:9.1.0088: TextChanged not triggered for :norm! commands (#27405)
Problem:  TextChanged not triggered for :norm! commands
          (machakann, after v9.0.2031)
Solution: Only reset curbuf->b_last_changedtick if TextChangedI
          was triggered in insert mode (and not blocked)

Note: for unknown reasons, the test fails on Windows (but seems to work
fine when running interactively)

fixes: vim/vim#13967
closes: vim/vim#13984

c9e79e5284

Cherry-pick test_autocmd.vim change from patch 8.2.4149.

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-02-10 06:53:26 +08:00
zeertzjq
0d4d3e4325
vim-patch:9.1.0084: Visual hl wrong when it ends before multibyte 'showbreak' (#27404)
Problem:  Visual hl wrong when it ends before multibyte 'showbreak'.
          (lacygoil)
Solution: Use vcol_sbr instead of adding n_extra.
          (zeertzjq)

fixes: vim/vim#11272
closes: vim/vim#13996

df23d7f4bd

Bug doesn't apply to Nvim.
2024-02-10 06:53:10 +08:00
bfredl
2d0e29614b refactor(api): use arena for nvim_get_option_info() 2024-02-09 19:30:35 +01:00
bfredl
2d8d35f838 refactor(api): use arena for nvim_parse_cmd() 2024-02-09 18:24:40 +01:00
bfredl
4cd43933d3 refactor(api): use arena for hlstate inspection 2024-02-09 18:24:31 +01:00
bfredl
e9510211f0 refactor(api): use arena for nvim_list_uis() 2024-02-09 18:24:21 +01:00
Will Hopkins
44ec4b5b18
refactor: rename FloatConfig to WinConfig #27397
`FloatConfig` is no longer used only for floats, so the name is counterintuitive.

Followup to #25550
2024-02-09 08:17:10 -08:00
bfredl
e0e5b7f0ba refactor(api): make cstr_as_string accept "const char*"
In the context a String inside an Object/Dictionary etc is consumed,
it is considered to be read-only.
2024-02-09 15:11:21 +01:00
dundargoc
4788abf2da build: stop installing parser.h from treesitter 2024-02-09 12:08:25 +01:00
Maria José Solano
0fe86f7e24 feat(lsp): add opts paramater to vim.lsp.codelens.refresh 2024-02-08 20:24:40 -08:00
ite-usagi
32b49448b2
feat(tutor): add Japanese tutor #27268
Add Japanese Tutor
2024-02-08 14:43:18 -08:00
Tomasz N
f0e61e6d92
fix(lsp): rename fails on missing parent directory #27291
Problem:
If a rename results in a path that has missing parent directory(s), it
will fail.

Solution:
Do a recursive mkdir before attempting the rename.
2024-02-08 13:06:54 -08:00
bfredl
52b6a9a93b
Merge pull request #27391 from bfredl/arenarock
refactor(api): refactor more api functions to use arena return
2024-02-08 18:54:00 +01:00
Lewis Russell
451bc50d40 feat(lsp): deprecate severity_limit
Problem:
  `vim.lsp.diagnostic.on_diagnostic` accepts an undocumented severity_limit
  option which is widely used.

Solution:
  Deprecate it in favour of `{min = severity}` used in `vim.diagnostic`.
  Since this is undocumented, the schedule for removal is accelerated to
  0.11.
2024-02-08 16:58:49 +00:00
Robert O'Shea
5c36701228
docs(install): add more Linux install instructions #27350 2024-02-08 06:55:53 -08:00
Lewis Russell
2f6d5588f3 Revert "fixup! add benchmark"
This reverts commit b0bff57a3b.
2024-02-08 14:55:09 +00:00
Lewis Russell
b0bff57a3b fixup! add benchmark 2024-02-08 14:54:36 +00:00