Commit Graph

6226 Commits

Author SHA1 Message Date
zeertzjq
62dc1f2663
vim-patch:8750e3cf81f1 (#26163)
runtime(netrw): Fix handling of very long filename on longlist style (vim/vim#12150)

If there is a file with a very long filename (longer than
g:netrw_maxfilenamelen), and if g:netrw_liststyle is set to 1, no space
is inserted between the filename and the filesize and the file cannot be
opened because of this.

E.g.:
```
$ echo hello > 12345678901234567890123456789012	  # 32 bytes: OK
$ echo hello > 123456789012345678901234567890123  # 33 bytes: not OK
$ echo hello > 1234567890123456789012345678901234 # 34 bytes: not OK
$ echo hello > こんにちは                         # multibyte filename
$ LC_ALL=C.UTF-8 vim . --clean --cmd "set loadplugins" --cmd "let g:netrw_liststyle=1"
```

Then, it will be shown like this:
```
" ============================================================================
" Netrw Directory Listing                                        (netrw v171)
"   /cygdrive/c/work/netrw-test
"   Sorted by      name
"   Sort sequence: [\/]$,\<core\%(\.\d\+\)\=\>,\.h$,\.c$,\.cpp$,\~\=\*$,*,\.o$,\
"   Quick Help: <F1>:help  -:go up dir  D:delete  R:rename  s:sort-by  x:special
" ==============================================================================
../                              0 Mon Mar 13 19:25:16 2023
./                               0 Mon Mar 13 19:44:58 2023
12345678901234567890123456789012 6 Mon Mar 13 19:29:43 2023
12345678901234567890123456789012346 Mon Mar 13 19:32:40 2023
1234567890123456789012345678901236 Mon Mar 13 19:29:49 2023
こんにちは                  6 Mon Mar 13 19:30:41 2023
```

If the length of the filename is 32 bytes, there is a space between the
filename and the filesize. However, when it is longer than 32 bytes, no
space is shown.

Also, you may find that the filesize of the multibyte named file is not
aligned.

After this patch is applied, the filelist will be shown like this:
```
" ============================================================================
" Netrw Directory Listing                                        (netrw v171)
"   /cygdrive/c/work/netrw-test
"   Sorted by      name
"   Sort sequence: [\/]$,\<core\%(\.\d\+\)\=\>,\.h$,\.c$,\.cpp$,\~\=\*$,*,\.o$,\
"   Quick Help: <F1>:help  -:go up dir  D:delete  R:rename  s:sort-by  x:special
" ==============================================================================
../                                             0 Mon Mar 13 20:49:22 2023
./                                              0 Mon Mar 13 21:12:14 2023
1234567890123456789012345678901             10000 Mon Mar 13 20:57:55 2023
12345678901234567890123456789012                6 Mon Mar 13 19:29:43 2023
123456789012345678901234567890123               6 Mon Mar 13 19:29:49 2023
1234567890123456789012345678901234              6 Mon Mar 13 19:32:40 2023
1234567890123456789012345678901234567       10000 Mon Mar 13 21:03:23 2023
1234567890123456789012345678901234567890    10000 Mon Mar 13 21:03:36 2023
123456789012345678901234567890123456789012  10000 Mon Mar 13 21:03:59 2023
1234567890123456789012345678901234567890123  10000 Mon Mar 13 21:03:45 2023
1234567890123456789012345678901234567890123456  5 Mon Mar 13 21:08:15 2023
12345678901234567890123456789012345678901234567  10 Mon Mar 13 21:05:21 2023
こんにちは                                      6 Mon Mar 13 19:30:41 2023
```

Now we have 32 + 2 + 15 = 49 characters for filename and filesize.
It tries to align the filesize as much as possible.
The last line that has multibyte filename is also aligned.

Also fixed the issue that the file list is not shown correctly when
g:netrw_sort_by is set to 'size' and g:netrw_sizestyle is set to 'h' or
'H'.

8750e3cf81

Co-authored-by: K.Takata <kentkt@csc.jp>
2023-11-23 17:02:53 +08:00
Luuk van Baal
c249058758 feat(extmarks): add sign name to extmark "details" array
Problem:  Unable to identify legacy signs when fetching extmarks with
          `nvim_buf_get_extmarks()`.
Solution: Add "sign_name" to the extmark detail array.

Add some misc. changes as follow-up to #25724
2023-11-22 12:43:59 +01:00
zeertzjq
059dc3f4a6
vim-patch:cb0c113ddc01 (#26147)
runtime(netrw): expand $COMSPEC without applying 'wildignore' (vim/vim#13542)

When expanding $COMSPEC and a user has set :set wildignore=*.exe
netrw won't be able to properly cmd.exe, because it does not ignore the
wildignore setting.

So let's explicitly use expand() without applying the 'wildignore' and
'suffixes' settings to the result

closes: vim/vim#13426

cb0c113ddc

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-11-22 11:06:46 +08:00
zeertzjq
820823c76d
vim-patch:596a9f29c83a (#26146)
runtime(doc): Fix whitespace and formatting of some help files (vim/vim#13549)

596a9f29c8

N/A patch:
vim-patch:aabca259fa48

Co-authored-by: h_east <h.east.727@gmail.com>
2023-11-22 10:46:11 +08:00
Mathias Fußenegger
7e97c773e3
perf(lsp): use async fs_stat for file watching on linux (#26123) 2023-11-21 17:46:19 +01:00
zeertzjq
fec5e3ab24
fix(vim.region): handle multibyte inclusive selection properly (#26129) 2023-11-21 14:25:45 +08:00
Mathias Fußenegger
ec79ff893d
refactor(lsp): add type annotations to _watchfiles (#26109) 2023-11-20 17:19:41 +01:00
Mathias Fußenegger
de28a0f84c
perf(lsp): replace file polling on linux with per dir watcher (#26108)
Should help with https://github.com/neovim/neovim/issues/23291

On linux `new_fs_event` doesn't support recursive watching, but we can
still use it to watch folders.

The downside of this approach is that we may end up sending some false
`Deleted` events. For example, if you save a file named `foo` there will
be a intermediate `foo~` due to the save mechanism of neovim.

The events we get from vim.uv in that case are:

- rename: foo~
- rename: foo~
- rename: foo
- rename: foo
- change: foo
- change: foo

The mechanism in this PR uses a debounce to reduce this to:

- deleted: foo~
- changed: foo

`foo~` will be the false positive.
I suspect that for the LSP case this is good enough. If not, we may need
to follow up on this and keep a table in memory that tracks available
files.
2023-11-19 14:25:32 +01:00
bfredl
df87266b23
Merge pull request #25724 from luukvbaal/signmerge
refactor(sign): move legacy signs to extmarks
2023-11-18 15:04:14 +01:00
Maria José Solano
7e36c8e972 feat(lsp): support for choice snippet nodes 2023-11-17 17:10:27 +01:00
Luuk van Baal
c4afb9788c refactor(sign): move legacy signs to extmarks
Problem:  The legacy signlist data structures and associated functions are
          redundant since the introduction of extmark signs.
Solution: Store signs defined through the legacy commands in a hashmap, placed
          signs in the extmark tree. Replace signlist associated functions.

Usage of the legacy sign commands should yield no change in behavior with the
exception of:
  - "orphaned signs" are now always removed when the line it is placed on is
    deleted. This used to depend on the value of 'signcolumn'.
  - It is no longer possible to place multiple signs with the same identifier
    in a single group on multiple lines. This will now move the sign instead.

Moreover, both signs placed through the legacy sign commands and through
|nvim_buf_set_extmark()|:
  - Will show up in both |sign-place| and |nvim_buf_get_extmarks()|.
  - Are displayed by increasing sign identifier, left to right.
    Extmark signs used to be ordered decreasingly as opposed to legacy signs.
2023-11-17 15:10:15 +01:00
Gregory Anders
677be4bdd2
docs: document breaking change of cursor blink behavior (#26075) 2023-11-17 08:07:35 -06:00
bfredl
b522cb1ac3 refactor(grid): make screen rendering more multibyte than ever before
Problem: buffer text with composing chars are converted from UTF-8
to an array of up to seven UTF-32 values and then converted back
to UTF-8 strings.

Solution: Convert buffer text directly to UTF-8 based schar_T values.

The limit of the text size is now in schar_T bytes, which is currently
31+1 but easily could be raised as it no longer multiplies the size
of the entire screen grid when not used, the full size is only required
for temporary scratch buffers.

Also does some general cleanup to win_line text handling, which was
unnecessarily complicated due to multibyte rendering being an "opt-in"
feature long ago. Nowadays, a char is just a char, regardless if it consists
of one ASCII byte or multiple bytes.
2023-11-17 12:58:57 +01:00
Tomasz N
86c2213b5e
fix(osc52): use p for primary selection instead of s (#26076)
Co-authored-by: Gregory Anders <greg@gpanders.com>
2023-11-16 19:52:22 -06:00
zeertzjq
a4c111ae69 vim-patch:9.0.2108: [security]: overflow with count for :s command
Problem:  [security]: overflow with count for :s command
Solution: Abort the :s command if the count is too large

If the count after the :s command is larger than what fits into a
(signed) long variable, abort with e_value_too_large.

Adds a test with INT_MAX as count and verify it correctly fails.

It seems the return value on Windows using mingw compiler wraps around,
so the initial test using :s/./b/9999999999999999999999999990 doesn't
fail there, since the count is wrapping around several times and finally
is no longer larger than 2147483647. So let's just use 2147483647 in the
test, which hopefully will always cause a failure

ac63787734

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-11-17 07:06:52 +08:00
Gregory Anders
5d75d9aef2
fix(osc52): enable OSC 52 by default in tmux sessions (#26072)
tmux has a set-clipboard option which, when set to 'on', allows
applications to set the system clipboard using the usual OSC 52 escape
sequence.
2023-11-16 13:56:05 -06:00
Gregory Anders
2f64546dc1
refactor: use optional base argument of tonumber (#26070) 2023-11-16 12:25:50 -06:00
Gregory Anders
db57df04b6
feat(clipboard): enable OSC 52 clipboard provider by default (#26064)
Use the XTGETTCAP sequence to determine if the host terminal supports
the OSC 52 sequence and, if it does, enable the OSC 52 clipboard
provider by default.

This is only done automatically when all of the following are true:

  1. Nvim is running in the TUI
  2. 'clipboard' is not set to unnamed or unnamedplus
  3. g:clipboard is unset
  4. Nvim is running in an SSH connection ($SSH_TTY is set)
  5. Nvim is not running inside tmux ($TMUX is unset)
2023-11-16 12:21:24 -06:00
Gregory Anders
4bf47222c9
feat: add vim.text module (#26069) 2023-11-16 11:35:54 -06:00
Gregory Anders
b4b7ca2d54
feat(tui): support DCS responses in TermResponse event (#26061) 2023-11-16 11:12:42 -06:00
Gregory Anders
dc3f84bf4f
docs: fix vim.snippet help tags (#26068) 2023-11-16 10:53:25 -06:00
Gregory Anders
ba58c6f8a4
fix: only attempt to close timer if not already closing (#26047)
This fixes an error that can occur in certain pathological cases when
the autocommand fires at just the right time such that it attempts to
close the timer after the timer has already exited, but before the
scheduled callback has fired.

We now let the timer continue to run even when the autocommand deletes
itself to avoid having to repeat the cleanup code multiple times. There
is no harm in letting the timer execute if the autocommand does not
exist, as the pcall will catch the error.
2023-11-14 17:02:57 -06:00
Christian Clason
c37f7bdba5 vim-patch:67abf1592c83
runtime(tar): comment out strange error condition check

67abf1592c

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-11-14 23:29:09 +01:00
Christian Clason
7e0f6211af vim-patch:30c762d99ac8
runtime(doc): fix typo in pi_gzip.txt

30c762d99a

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-11-14 23:29:09 +01:00
Christian Clason
9e2248ab58 vim-patch:9.0.2104: wast filetype should be replaced by wat filetype
Problem:  wast filetype should be replaced by wat filetype
Solution: start using the official wat filetype name

runtime: rename `wast` filetype to `wat` (Wasm text format)

The problem is the name of the current filetype wast. When the plugin
was initially created, the file extension for Wasm text format was not
fixed and .wast was more popular.

However, recently .wat became the official file extension for
WebAssembly text (WAT) format and .wast is now a file extension for the
unofficial WAST format, which is a superset of .wat for the convenience
to describe the Wasm specification conformance tests.

https://webassembly.js.org/docs/contrib-wat-vs-wast.html

However for now, let's keep using the `wat` filetype even for the .wast
extension, so that we at least do not lose the filetype settings and
syntax highlighting. This can be adjusted later, if it turns out to have
a separate need for.

closes: vim/vim#13533

bc8f79d36a

Co-authored-by: rhysd <lin90162@yahoo.co.jp>
2023-11-14 21:51:28 +01:00
Gregory Anders
ac8ed77afb
feat(tui): add 'termsync' option (#25871)
The 'termsync' option enables a mode (provided the underlying terminal
supports it) where all screen updates during a redraw cycle are buffered
and drawn together when the redraw is complete. This eliminates tearing
or flickering in cases where Nvim redraws slower than the terminal
redraws the screen.
2023-11-14 08:53:58 -06:00
Justin M. Keyes
b73a829837
refactor: vim.ui.clipboard #26040
Problem:
Platform-specific UI providers should live in `vim.ui.*`. #24164

Solution:
- Move `vim.clipboard.osc52` module to `vim.ui.clipboard.osc52`.
- TODO: move all of `clipboard.vim` to `vim.ui.clipboard`.

ref #25872
2023-11-14 05:15:45 -08:00
Ploum
5b45efbee6
fix(defaults): set 'fsync' #26034
Problem:
'nofsync' may lose data if the system has a hard shutdown. #9888

Solution:
Change default to 'fsync'. This may be revisited in the future when
'nofsync' can be made safer.
2023-11-14 02:56:50 -08:00
Gregory Anders
8d9789a0f3 docs: deprecate the "term_background" UI field 2023-11-13 19:04:47 -06:00
Gregory Anders
ab102f188e refactor: move background color detection into Lua 2023-11-13 19:04:46 -06:00
Chris Simon
48bcc7b971
fix(lsp): advertise workspace.didChangeConfiguration capability (#26028)
This ensures workspace/didChangeConfiguration notification sent after init is correctly handled
2023-11-13 19:39:43 +01:00
zeertzjq
2a58aa5709
vim-patch:9.0.2102: matchparen highlight not cleared in completion mode (#26019)
Problem:  matchparen highlight not cleared in completion mode
Solution: Clear matchparen highlighting in completion mode

Remove hard-coded hack in insexpand.c to clear the :3match before
displaying the completion menu.

Add a test for matchparen highlighting. While at it, move all test tests
related to the matchparen plugin into a separate test file.

closes: vim/vim#13493
closes: vim/vim#13524

9588666360

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-11-13 10:47:12 +08:00
zeertzjq
d2983dcdb1
fix(clipboard): make osc52 work with PUC Lua (#26014) 2023-11-13 07:27:45 +08:00
zeertzjq
6d14f3ddab
vim-patch:9.0.2103: recursive callback may cause issues on some archs (#26013)
Problem:  recursive callback may cause issues on some archs
Solution: Decrease the limit drastically to 20

Recursive callback limit causes problems on some architectures

Since commit 47510f3d6598a1218958c03ed11337a43b73f48d we have a test
that causes a recursive popup callback function to be executed. However
it seems the current limit of 'maxfuncdepth' option value is still too
recursive for some 32bit architectures (e.g. 32bit ARM).

So instead of allowing a default limit of 100 (default value for
'maxfuncdepth'), let's reduce this limit to 20. I don't think there is a
use case where one would need such a high recursive callback limit and a
limit of 20 seems reasonable (although it is currently hard-coded).

closes: vim/vim#13495
closes: vim/vim#13502

2076463e38

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-11-13 06:33:34 +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
4f8941c1a5 refactor: replace manual header guards with #pragma once
It is less error-prone than manually defining header guards. Pretty much
all compilers support it even if it's not part of the C standard.
2023-11-12 22:01:28 +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
Christian Clason
c6b317dd13 vim-patch:2c133f6c1a16
runtime(lynx): Update for Lynx 2.8.9 (vim/vim#13510)

2c133f6c1a

Co-authored-by: dkearns <dougkearns@gmail.com>
2023-11-12 10:53:57 +01:00
zeertzjq
b331302442
vim-patch:9358b8d99349 (#25998)
runtime(vim): Improve :let-heredoc syntax highlighting (vim/vim#12923)

"trim" and "eval" are allowed in any order and whitespace is not
required after "=<<".

9358b8d993

Co-authored-by: dkearns <dougkearns@gmail.com>
2023-11-12 08:26:56 +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
zeertzjq
2494009885
vim-patch:1b08d2cd0789 (#25993)
runtime(doc): clarify when formatoptions applies

closes: vim/vim#13503

1b08d2cd07

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-11-12 07:49:57 +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
Christian Clason
be83cd73b2 vim-patch:5994329667a6
runtime(i3config): Update for i3 4.23 (vim/vim#13522)

5994329667

Co-authored-by: Ivan Grimaldi <grimaldi.ivan@gmail.com>
Co-authored-by: Ivan Grimaldi <grimaldi.ivam@gmail.com>
2023-11-11 15:11:49 +01:00
Christian Clason
ae8ca79920 vim-patch:d56f15caf602
runtime(wget): Update for Wget2 2.1.0 (vim/vim#13497)

d56f15caf6

Co-authored-by: dkearns <dougkearns@gmail.com>
2023-11-09 19:17:11 +01: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
610f50ddaf
vim-patch:20a94f44b3cd (#25946)
runtime(doc): fix grammar in termdebug doc, remove trailing spaces (vim/vim#13505)

20a94f44b3
2023-11-09 15:46:14 +08:00