Commit Graph

6420 Commits

Author SHA1 Message Date
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
zeertzjq
054839437e
test(plugin/man_spec): use pesc() on actual_file in pattern (#25199) 2023-09-17 06:07:53 +08:00
bfredl
883e2a1409
Merge pull request #25186 from llllvvuu/fix/preserve_marktree_orderinh
fix(marktree): preserve ordering in `marktree_move`
2023-09-16 14:59:20 +02:00
bfredl
477458f7bf
fix(test): more tests for marktree
Co-Authored-By: L Lllvvuu <git@llllvvuu.dev>
2023-09-16 05:32:45 -07:00
L Lllvvuu
908843df61 fix(languagetree): apply resolve_lang to metadata['injection.language']
`resolve_lang` is applied to `@injection.language` when it's supplied as a
capture:

f5953edbac/runtime/lua/vim/treesitter/languagetree.lua (L766-L768)

If we want to support `metadata['injection.language']` (as per #22518 and
[tree-sitter upstream](https://tree-sitter.github.io/tree-sitter/syntax-highlighting#language-injection))
then the behavior should be consistent.

Fixes: nvim-treesitter/nvim-treesitter#4918
2023-09-16 11:12:06 +01:00
bfredl
40bfca744d
Merge pull request #25183 from llllvvuu/fix/marktree_move
fix(marktree): off-by-one error in `marktree_move`
2023-09-16 10:39:54 +02:00
bfredl
2d2cf150e1
Merge pull request #25078 from glepnir/au
fix(float): don't trigger au event when enter is false
2023-09-16 10:27:45 +02:00
L Lllvvuu
585549625d
fix(marktree): off-by-one error in marktree_move
If you would insert element X at position j, then if you are moving that
same element X from position i < j, you should move it to position j -
1, because you are losing an element.

This error caused a gap to be left in the array, so that it looked like
[x, null, y] instead of [x, y], where len = 2. This triggered #25147.

Fixes: #25147
2023-09-16 01:12:15 -07:00
zeertzjq
35e50d79c6
fix(extmarks): overlay virt_text position after 'showbreak' (#25175)
Also make virt_text_hide work properly.
2023-09-15 20:30:50 +08:00
glepnir
a916523574 fix(ui): doesn't trigger au event when enter is false 2023-09-15 19:18:01 +08:00
Ilia Choly
f5a09f1b03
fix: invoke changed_bytes when rewriting <Tab> char #25125
When tabstop and shiftwidth are not equal, tabs are inserted as individual
spaces and then rewritten as tab characters in a second pass. That second pass
did not call changed_bytes which resulted in events being omitted.

Fixes #25092
2023-09-15 03:45:51 -07:00
dundargoc
2d9e7a33f4
test(windows): unskip working tests (#25153)
Also simplify home detection with os_homedir()
2023-09-15 16:33:26 +08:00
zeertzjq
a6e4793baf
fix(extmarks): draw virt_text below diff filler lines properly (#25170)
fix(extmarks): draw virt_text properly below diff filler lines
2023-09-15 15:56:52 +08:00
zeertzjq
b65cd7ff1a
fix(extmarks): fix wrong virt_text position after wrapped TAB (#25168) 2023-09-15 14:54:42 +08:00
zeertzjq
b52bd8a2de
fix(extmarks): properly handle virt_text on next screen line (#25166)
TODO: virt_text_hide doesn't work for the first char on a wrapped screen
line, and it's not clear how to fix that.
2023-09-15 12:35:27 +08:00
zeertzjq
f5953edbac
fix(float): update position of anchored windows first (#25133) 2023-09-14 07:42:22 +08:00
bfredl
b04286a187 feat(extmark): support proper multiline ranges
The removes the previous restriction that nvim_buf_set_extmark()
could not be used to highlight arbitrary multi-line regions

The problem can be summarized as follows: let's assume an extmark with a
hl_group is placed covering the region (5,0) to (50,0) Now, consider
what happens if nvim needs to redraw a window covering the lines 20-30.
It needs to be able to ask the marktree what extmarks cover this region,
even if they don't begin or end here.

Therefore the marktree needs to be augmented with the information covers
a point, not just what marks begin or end there. To do this, we augment
each node with a field "intersect" which is a set the ids of the
marks which overlap this node, but only if it is not part of the set of
any parent. This ensures the number of nodes that need to be explicitly
marked grows only logarithmically with the total number of explicitly
nodes (and thus the number of of overlapping marks).

Thus we can quickly iterate all marks which overlaps any query position
by looking up what leaf node contains that position. Then we only need
to consider all "start" marks within that leaf node, and the "intersect"
set of that node and all its parents.

Now, and the major source of complexity is that the tree restructuring
operations (to ensure that each node has T-1 <= size <= 2*T-1) also need
to update these sets. If a full inner node is split in two, one of the
new parents might start to completely overlap some ranges and its ids
will need to be moved from its children's sets to its own set.
Similarly, if two undersized nodes gets joined into one, it might no
longer completely overlap some ranges, and now the children which do
needs to have the have the ids in its set instead. And then there are
the pivots! Yes the pivot operations when a child gets moved from one
parent to another.
2023-09-12 10:38:23 +02:00
Jaehwang Jung
65738202f8
fix(decorations): better approximation of botline #24794
Problem:
* The guessed botline might be smaller than the actual botline e.g. when
  there are folds and the user is typing in insert mode. This may result
  in incorrect treesitter highlights for injections.
* botline can be larger than the last line number of the buffer, which
  results in errors when placing extmarks.

Solution:
* Take a more conservative approximation. I am not sure if it is
  sufficient to guarantee correctness, but it seems to be good enough
  for the case mentioned above.
* Clamp it to the last line number.

Co-authored-by: Lewis Russell <me@lewisr.dev>
2023-09-11 12:29:39 -07:00
Sergey Slipchenko
f859d16aea
fix(tests): set SHELL=sh #24941
Problem:
Some tests fail with $SHELL=fish #6172
Related: https://github.com/neovim/neovim/pull/6176

Solution:
Replace "echo -n" with "printf", because "echo" in sh may be provided
as a shell builtin, which does not accept an "-n" flag to avoid a
trailing newline (e.g. on macos). "printf" is more portable (defined by
POSIX) and it does not output a trailing newline by itself.
Fixes #6172

TODO:
Other test failures may be related to "session leader" issue: https://github.com/neovim/neovim/issues/2354
Checked by running `:terminal ./build/bin/tty-test` from Nvim with
`shell=/bin/fish` (inherited from `$SHELL`) and it indeed complains
about "process does not own the terminal". With `shell=sh` it doesn't complain. And
unsetting `$SHELL` seems to make `nvim` to fall back to `shell=sh`.

    FAILED   test/functional/terminal/tui_spec.lua @ 1017: TUI paste: terminal mode
    test/functional/terminal/tui_spec.lua:1024: Row 1 did not match.
    Expected:
      |*tty ready                                         |
      |*{1: }                                                 |
      |*                                                  |
      |                                                  |
      |{5:^^^^^^^                                           }|
      |{3:-- TERMINAL --}                                    |
      |{3:-- TERMINAL --}                                    |
    Actual:
      |*process does not own the terminal                 |
      |*                                                  |
      |*[Process exited 2]{1: }                               |
      |                                                  |
      |{5:^^^^^^^                                           }|
      |{3:-- TERMINAL --}                                    |
      |{3:-- TERMINAL --}                                    |

    To print the expect() call that would assert the current screen state, use
    screen:snapshot_util(). In case of non-deterministic failures, use
    screen:redraw_debug() to show all intermediate screen states.

    stack traceback:
        test/functional/ui/screen.lua:622: in function '_wait'
        test/functional/ui/screen.lua:352: in function 'expect'
        test/functional/terminal/tui_spec.lua:1024: in function <test/functional/terminal/tui_spec.lua:1017>

    FAILED   test/functional/terminal/tui_spec.lua @ 1551: TUI forwards :term palette colors with termguicolors
    test/functional/terminal/tui_spec.lua:1567: Row 1 did not match.
    Expected:
      |*{1:t}ty ready                                         |
      |                                                  |
      |*                                                  |
      |                                                  |
      |{2:^^^^^^^                                           }|
      |                                                  |
      |{3:-- TERMINAL --}                                    |
    Actual:
      |*{1:p}rocess does not own the terminal                 |
      |                                                  |
      |*[Process exited 2]                                |
      |                                                  |
      |{2:^^^^^^^                                           }|
      |                                                  |
      |{3:-- TERMINAL --}                                    |

    To print the expect() call that would assert the current screen state, use
    screen:snapshot_util(). In case of non-deterministic failures, use
    screen:redraw_debug() to show all intermediate screen states.

    stack traceback:
        test/functional/ui/screen.lua:622: in function '_wait'
        test/functional/ui/screen.lua:352: in function 'expect'
        test/functional/terminal/tui_spec.lua:1567: in function <test/functional/terminal/tui_spec.lua:1551>
2023-09-11 10:01:00 -07:00
bfredl
616a9bac32
Merge pull request #24901 from faergeek/more-intuitive-cursor-update
fix(api): more intuitive cursor updates in nvim_buf_set_text
2023-09-11 10:45:45 +02:00
Christian Clason
60e5d0fbcc vim-patch:9.0.1891: No runtime support for Mojo
Problem:  No runtime support for Mojo
Solution: Add basic filetype and syntax plugins

closes: vim/vim#13062
closes: vim/vim#13063

0ce2c594d0

Co-authored-by: Mahmoud Abduljawad <mahmoud@masaar.com>
2023-09-11 10:05:54 +02:00
Sergey Slipchenko
d22172f36b
fix(api): more intuitive cursor updates in nvim_buf_set_text
Fixes #22526
2023-09-11 08:16:03 +04:00
zeertzjq
e8d25675a2 vim-patch:9.0.1894: CI: trailing whitespace in tests
Problem:  CI: trailing white space in tests
Solution: clean up the trailing white space

e5f7cd0a60

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-09-11 11:16:50 +08:00
zeertzjq
6484f338a4 vim-patch:9.0.1893: CI: strptime test fails on BSD14
Problem:  CI: strptime test fails on BSD14
Solution: Skip the test

983d808674

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-09-11 11:16:50 +08:00
zeertzjq
2b475cb5cc
fix(mouse): click on 'statuscolumn' with 'rightleft' (#25090) 2023-09-11 08:29:33 +08:00
Sergey Slipchenko
af0684f0d5
test: unignore test which froze sourcehut (#25067) 2023-09-11 05:53:05 +08:00
dundargoc
9f8f287c61 build: remove luarocks
Luarocks is no longer needed after
25e51d393a.
2023-09-10 15:32:47 +02:00
Grace Petryk
5e3cf9fb4b
feat(lsp): improve control over placement of floating windows (#24494) 2023-09-10 10:02:23 +02:00
bfredl
d4e80a051e
Merge pull request #25039 from glepnir/fix_hl
fix(highlight): add create param in nvim_get_hl api function
2023-09-09 13:01:40 +02:00
zeertzjq
b9d9cd7742 vim-patch:partial:9.0.1886: Various Typos
Problem:  Various Typos
Solution: Fix Typos

This is a collection of typo related commits.

closes: vim/vim#12753
closes: vim/vim#13016

ee17b6f70d

Co-authored-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Adri Verhoef <a3@a3.xs4all.nl>
Co-authored-by: Viktor Szépe <viktor@szepe.net>
Co-authored-by: nuid64 <lvkuzvesov@proton.me>
Co-authored-by: Meng Xiangzhuo <aumo@foxmail.com>
Co-authored-by: Dominique Pellé <dominique.pelle@gmail.com>
2023-09-09 17:58:32 +08:00
zeertzjq
bc09fc04b8 vim-patch:9.0.1877: missing test for patch 9.0.1873
Problem:  missing test for patch 9.0.1873
Solution: add a test trying to exchange windows

Add a test, making sure that switching windows is not allowed when
textlock is active, e.g. when running `:s/<pat>/\=func()/`

18d2709aa1

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-09-09 17:53:01 +08:00
glepnir
8afb3a49c0 fix(highlight): add create param in nvim_get_hl 2023-09-09 17:15:58 +08:00
bfredl
5970157e1d refactor(map): enhanced implementation, Clean Code™, etc etc
This involves two redesigns of the map.c implementations:

1. Change of macro style and code organization

The old khash.h and map.c implementation used huge #define blocks with a
lot of backslash line continuations.

This instead uses the "implementation file" .c.h pattern. Such a file is
meant to be included multiple times, with different macros set prior to
inclusion as parameters. we already use this pattern e.g. for
eval/typval_encode.c.h to implement different typval encoders reusing a
similar structure.

We can structure this code into two parts. one that only depends on key
type and is enough to implement sets, and one which depends on both key
and value to implement maps (as a wrapper around sets, with an added
value[] array)

2. Separate the main hash buckets from the key / value arrays

Change the hack buckets to only contain an index into separate key /
value arrays
This is a common pattern in modern, state of the art hashmap
implementations. Even though this leads to one more allocated array, it
is this often is a net reduction of memory consumption. Consider
key+value consuming at least 12 bytes per pair. On average, we will have
twice as many buckets per item.
Thus old implementation:

  2*12 = 24 bytes per item

New implementation

  1*12 + 2*4 = 20 bytes per item

And the difference gets bigger with larger items.
One might think we have pulled a fast one here, as wouldn't the average size of
the new key/value arrays be 1.5 slots per items due to amortized grows?
But remember, these arrays are fully dense, and thus the accessed memory,
measured in _cache lines_, the unit which actually matters, will be the
fully used memory but just rounded up to the nearest cache line
boundary.

This has some other interesting properties, such as an insert-only
set/map will be fully ordered by insert only. Preserving this ordering
in face of deletions is more tricky tho. As we currently don't use
ordered maps, the "delete" operation maintains compactness of the item
arrays in the simplest way by breaking the ordering. It would be
possible to implement an order-preserving delete although at some cost,
like allowing the items array to become non-dense until the next rehash.

Finally, in face of these two major changes, all code used in khash.h
has been integrated into map.c and friends. Given the heavy edits it
makes no sense to "layer" the code into a vendored and a wrapper part.
Rather, the layered cake follows the specialization depth: code shared
for all maps, code specialized to a key type (and its equivalence
relation), and finally code specialized to value+key type.
2023-09-08 12:48:46 +02:00
bfredl
6985e12cae refactor(build): derocksify luacheck 2023-09-07 15:26:30 +02:00
Tom Praschan
131a1ee82d
feat(lsp): add original LSP Location as item's user_data in locations_to_items (#23743) 2023-09-07 10:12:02 +02:00
Evgeni Chasnovski
d272143318
fix(diagnostic): always return copies of diagnostic items (#25010) 2023-09-06 12:54:18 -05:00
zeertzjq
0909843647 vim-patch:9.0.1874: CI may fail in test_recover_empty_swap
Problem:  CI may fail in test_recover_empty_swap
Solution: Set directory option

Fix failing Test_recover_empty_swap test

:recover by default not only looks in the current directory, but also in
~/tmp for files to recover. If it finds some files to recover, it will
interactively prompt for a file to recover. However, prompting doesn't
work when running the test suite (and even if it would, there is no one
that can answer the prompt).

So it doesn't really make sense during testing, to inspect different
directories for swap files and prompt and wait (which will lead to a
timeout and therefore a failing test).

So set the 'directory' option temporarily to the current directory only
and reset it back once the test finishes.

closes: vim/vim#13038

1c7397f3f1

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-09-06 06:28:23 +08:00
zeertzjq
3e5a7f258a vim-patch:partial:9.0.0669: too many delete() calls in tests
Problem:    Too many delete() calls in tests.
Solution:   Use deferred delete where possible.

db77cb3c08

Include test_recover.vim changes only.
Cherry-pick test_recover.vim change from patch 8.2.3637.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-09-06 06:28:23 +08:00
zeertzjq
33d6cf70cc
test(old): reorder test_quickfix.vim to match upstream (#25029) 2023-09-06 06:28:03 +08:00
Lewis Russell
4ce9875feb
Merge pull request #25006 from lewis6991/fix/systemkill
`vim.system` fixes and improvements
2023-09-05 21:50:18 +01:00
Lewis Russell
80d1333b73 refactor(vim.system): factor out on_exit handling 2023-09-05 17:10:04 +01:00
Lewis Russell
6d5f12efd2 fix(vim.system): make timeout work properly
Mimic the behaviour of timeout(1) from coreutils.
2023-09-05 17:10:01 +01:00
zeertzjq
c3e176f6e2
fix(options): correct condition for calling did_set_option() (#25026) 2023-09-05 20:03:25 +08:00
Lewis Russell
a44521f46e fix(vim.system): let on_exit handle cleanup after kill
Fixes #25000
2023-09-05 10:18:26 +01:00
zeertzjq
65d3378009
vim-patch:9.0.1866: undo is synced after character find (#25021)
vim-patch:9.0.1866: undo is synced after character find

Problem:  Undo is synced after character find.
Solution: Set no_u_sync when calling gotchars_nop().

closes: vim/vim#13022
closes: vim/vim#13024

dccc29c228
2023-09-05 06:25:51 +08:00
zeertzjq
c431d820e7
vim-patch:9.0.1856: issues with formatting positional arguments (#25013)
Problem:  issues with formatting positional arguments
Solution: fix them, add tests and documentation

closes: vim/vim#12140
closes: vim/vim#12985

Tentatively fix message_test. Check NULL ptr.

aa90d4f031

Co-authored-by: Christ van Willegen <cvwillegen@gmail.com>
2023-09-04 08:49:50 +08:00
zeertzjq
bebdf1dab3
vim-patch:9.0.1848: [security] buffer-overflow in vim_regsub_both() (#25001)
Problem:  buffer-overflow in vim_regsub_both()
Solution: Check remaining space

ced2c7394a

The change to do_sub() looks confusing. Maybe it's an overflow check?
Then the crash may not be applicable to Nvim because of different casts.
The test also looks confusing. It seems to source itself recursively.
Also don't call strlen() twice on evaluation result.

N/A patches for version.c:
vim-patch:9.0.1849: CI error on different signedness in ex_cmds.c
vim-patch:9.0.1853: CI error on different signedness in regexp.c

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-09-03 13:47:55 +08:00
zeertzjq
087ef52997
vim-patch:9.0.1840: [security] use-after-free in do_ecmd (#24993)
Problem:  use-after-free in do_ecmd
Solution: Verify oldwin pointer after reset_VIsual()

e1dc9a6275

N/A patches for version.c:
vim-patch:9.0.1841: style: trailing whitespace in ex_cmds.c

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-09-03 11:15:43 +08:00
Maria José Solano
517dfdf0fc
fix(shada): update marks when using delmarks! (#24978) 2023-09-03 10:34:09 +08:00
zeertzjq
b55010a539 vim-patch:9.0.1846: [security] crash in fullcommand
Problem:  crash in fullcommand
Solution: Check for typeval correctly

4c6fe2e2ea

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-09-03 09:14:30 +08:00
zeertzjq
272c4fba83
vim-patch:9.0.1852: i_CTRL-O does not reset Select Mode (#24990)
Problem:  i_CTRL-O does not reset Select Mode
Solution: Reset select mode on CTRL-O in insert mode

closes: vim/vim#13001
closes: vim/vim#12115

d69aecf141

Co-authored-by: pierreganty <pierreganty@gmail.com>
Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-09-03 09:04:58 +08:00