Commit Graph
118 Commits
Author SHA1 Message Date
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
zeertzjqandChristian Brabandt 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

https://github.com/vim/vim/commit/2076463e383901cef44685aaf4b63e4306444f9e

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-11-13 06:33:34 +08:00
zeertzjqandChristian Brabandt 2494009885 vim-patch:1b08d2cd0789 (#25993)
runtime(doc): clarify when formatoptions applies

closes: vim/vim#13503

https://github.com/vim/vim/commit/1b08d2cd0789fd9aaae148a64ff46342730022d7

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-11-12 07:49:57 +08:00
zeertzjqandErnie Rael 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)

https://github.com/vim/vim/commit/d8f5f766219273a8579947cc80b92580b6988a4b

Co-authored-by: Ernie Rael <errael@raelity.com>
2023-11-09 21:34:04 +08:00
zeertzjqandErnie Rael 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)

https://github.com/vim/vim/commit/51d04d16f21e19d6eded98f9530d84089102f925

Co-authored-by: Ernie Rael <errael@raelity.com>
2023-11-09 21:34:04 +08:00
zeertzjqandErnie Rael 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.

https://github.com/vim/vim/commit/09661203ecefbee6a6f09438afcff1843e9dbfb4

Co-authored-by: Ernie Rael <errael@raelity.com>
2023-11-09 21:34:04 +08:00
zeertzjqandErnie Rael 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)

https://github.com/vim/vim/commit/659c240cf769925ff432b88df8719e7ace4629b0

Co-authored-by: Ernie Rael <errael@raelity.com>
2023-11-09 21:34:04 +08:00
zeertzjqandBram Moolenaar 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".

https://github.com/vim/vim/commit/a9528b39a666dbaa026320f73bae4b1628a7fe51

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-11-09 21:34:02 +08:00
zeertzjqandChristian Brabandt f7b2ea59a6 vim-patch:9.0.2095: statusline may look different than expected (#25941)
Problem:  statusline may look different than expected
Solution: do not check for highlighting of stl and stlnc characters

statusline fillchar may be different than expected

If the highlighting group for the statusline for the current window
|hl-StatusLine| or the non-current window |hl-StatusLineNC| are cleared
(or do not differ from each other), than Vim will use the hard-coded
fallback values '^' (for the non-current windows) or '=' (for the
current window).  I believe this was done, to make sure the statusline
will always be visible and be distinguishable from the rest of the
window.

However, this may be unexpected, if a user explicitly defined those
fillchar characters just to notice that those values are then not used
by Vim.

So, let's assume users know what they are doing and just always return
the configured stl and stlnc values.  And if they want the statusline to
be non-distinguishable from the rest of the window space, so be it.  It
is their responsibility and Vim shall not know better what to use.

fixes: vim/vim#13366
closes: vim/vim#13488

https://github.com/vim/vim/commit/6a650bf696f1df3214b3d788947447c5bbf1a77d

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-11-09 06:34:34 +08:00
bfredl 1b0fd377ab Merge pull request #25767 from luukvbaal/signdel
feat(extmarks): add 'invalidate' property
2023-11-08 12:17:25 +01:00
Luuk van Baal 4e6f559b8c feat(extmarks): add 'invalidate' property to extmarks
Problem:  No way to have extmarks automatically removed when the range it
          is attached to is deleted.
Solution: Add new 'invalidate' property that will hide a mark when the
          entirety of its range is deleted. When "undo_restore" is set
          to false, delete the mark from the buffer instead.
2023-11-08 02:53:49 +01:00
Gregory Anders 56627ca242 feat(tui): use TermResponse event for OSC responses (#25868)
When the terminal emulator sends an OSC sequence to Nvim (as a response
to another OSC sequence that was first sent by Nvim), populate the OSC
sequence in the v:termresponse variable and fire the TermResponse event.
The escape sequence is also included in the "data" field of the
autocommand callback when the autocommand is defined in Lua.

This makes use of the already documented but unimplemented TermResponse
event. This event exists in Vim but is only fired when Vim receives a
primary device attributes response.

Fixes: https://github.com/neovim/neovim/issues/25856
2023-11-06 12:42:40 -06:00
Gregory Anders 224f303ee5 feat(stdlib): add vim.base64 module (#25843)
Add base64 encode() and decode() functions to a vim.base64 module.
2023-10-31 09:15:32 -05:00
2dc9ceb99c docs: small fixes (#25585)
Co-authored-by: tmummert <doczook@gmx.de>
Co-authored-by: parikshit adhikari <parikshitadhikari@gmail.com>
2023-10-29 16:02:32 +08:00
zeertzjqanddkearns a2a1a65b98 vim-patch:8ebdbc9e6d80 (#25816)
runtime(doc): all secure options should note this restriction in the documentation (vim/vim#13448)

Problem:  Not all secure options document their status
Solution: Describe secure context :set restrictions in each help entry

https://github.com/vim/vim/commit/8ebdbc9e6d80b707c2b2d923e702dc86bf902923

Co-authored-by: dkearns <dougkearns@gmail.com>
2023-10-29 06:15:13 +08:00
bfe8a39512 vim-patch:partial:5985879e3c36 (#25780)
runtime(doc): Fix typos in several documents (vim/vim#13420)

* Fix typos in several documents
* Update runtime/doc/terminal.txt

https://github.com/vim/vim/commit/5985879e3c36383155f84649fa42d06813a1893e

Skip runtime/doc/indent.txt: not ported yet

Co-authored-by: h_east <h.east.727@gmail.com>
Co-authored-by: K.Takata <kentkt@csc.jp>
2023-10-26 06:41:54 +08:00
glepnir ae4ca4edf8 feat(complete): support f flag for complete buffer part 2023-10-21 20:06:36 +08:00
zeertzjqandIllia Bobyr bc5dfda441 vim-patch:9.0.2041: trim(): hard to use default mask (#25692)
Problem:  trim(): hard to use default mask (partly revert v9.0.2040)
Solution: use default mask when it is empty

The default 'mask' value is pretty complex, as it includes many
characters.  Yet, if one needs to specify the trimming direction, the
third argument, 'trim()' currently requires the 'mask' value to be
provided explicitly.

Currently, an empty 'mask' will make 'trim()' call return 'text' value
that is passed in unmodified.  It is unlikely that someone is using it,
so the chances of scripts being broken by this change are low.

Also, this reverts commit 9.0.2040 (which uses v:none for the default
and requires to use an empty string instead).

closes: vim/vim#13358

https://github.com/vim/vim/commit/8079917447e7436dccc2e4cd4a4a56ae0a4712f2

vim-patch:9.0.2040: trim(): hard to use default mask

Problem:  trim(): hard to use default mask
Solution: Use default 'mask' when it is v:none

The default 'mask' value is pretty complex, as it includes many
characters.  Yet, if one needs to specify the trimming direction, the
third argument, 'trim()' currently requires the 'mask' value to be
provided explicitly.

'v:none' is already used to mean "use the default argument value" in
user defined functions.  See |none-function_argument| in help.

closes: vim/vim#13363

https://github.com/vim/vim/commit/6e6386716f9494ae86027c6d34f657fd03dfec42

Co-authored-by: Illia Bobyr <illia.bobyr@gmail.com>
2023-10-18 06:08:14 +08:00
zeertzjqandYee Cheng Chin 272ef27115 vim-patch:9.0.2035: [security] use-after-free with wildmenu (#25687)
Problem:  [security] use-after-free with wildmenu
Solution: properly clean up the wildmenu when exiting

Fix wildchar/wildmenu/pum memory corruption with special wildchar's

Currently, using `wildchar=<Esc>` or `wildchar=<C-\>` can lead to a
memory corruption if using wildmenu+pum, or wrong states if only using
wildmenu. This is due to the code only using one single place inside the
cmdline process loop to perform wild menu clean up (by checking
`end_wildmenu`) but there are other odd situations where the loop could
have exited and we need a post-loop clean up just to be sure. If the
clean up was not done you would have a stale popup menu referring to
invalid memory, or if not using popup menu, incorrect status line (if
`laststatus=0`).

For example, if you hit `<Esc>` two times when it's wildchar, there's a
hard-coded behavior to exit command-line as a failsafe for user, and if
you hit `<C-\><C-\><C-N>` it will also exit command-line, but the clean
up code would not have hit because of specialized `<C-\>` handling.

Fix Ctrl-E / Ctrl-Y to not cancel/accept wildmenu if they are also
used for 'wildchar'/'wildcharm'. Currently they don't behave properly,
and also have potentially memory unsafe behavior as the logic is
currently not accounting for this situation and try to do both.
(Previous patch that addressed this: vim/vim#11677)

Also, correctly document Escape key behavior (double-hit it to escape)
in wildchar docs as it's previously undocumented.

In addition, block known invalid chars to be set in `wildchar` option,
such as Ctrl-C and `<CR>`. This is just to make it clear to the user
they shouldn't be set, and is not required for this bug fix.

closes: vim/vim#13361

https://github.com/vim/vim/commit/8f4fb007e4d472b09ff6bed9ffa485e0c3093699

Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2023-10-17 22:43:42 +08:00
zeertzjq d974a3dcbb vim-patch:9.0.2032: cannot get mouse click pos for tab or virt text (#25653)
Problem:  Cannot accurately get mouse clicking position when clicking on
          a TAB or with virtual text.
Solution: Add a "coladd" field to getmousepos() result.

closes: vim/vim#13335

https://github.com/vim/vim/commit/f5a94d5165bb9e390797da50a1fa7a87df3fbee4
2023-10-15 17:19:01 +08:00
zeertzjqandChristian Brabandt e5a424d78e vim-patch:9.0.2030: no max callback recursion limit (#25655)
Problem:  no max callback recursion limit
Solution: bail out, if max call recursion for callback functions
          has been reached.

This checks the 'maxfuncdepth' setting and throws E169 when a callback
function recursively calls itself.

closes: vim/vim#13337
closes: vim/vim#13339

https://github.com/vim/vim/commit/47510f3d6598a1218958c03ed11337a43b73f48d

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-10-15 17:02:17 +08:00
zeertzjq aa62579a68 docs: restore accidentally removed line in :h 'ignorecase' (#25651) 2023-10-15 09:05:27 +08:00
zeertzjqandYee Cheng Chin 20dacacf37 vim-patch:2bbd0d30eebd (#25637)
runtime(doc): Improve command-line completion docs (vim/vim#13331)

* Improve command-line completion docs

Add more details about 'ignorecase' and its effect on cmdline
completion.

Make sure keys used in wildmenu are properly documented and linked in the
keys' documentation entries, and in `:h index` for proper
cross-referencing, as wildmenu popup is slightly different from
insert-mode popup menu.

* Fix docs typos

https://github.com/vim/vim/commit/2bbd0d30eebdea66c0da3895e83d999ed6ad83fb

Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2023-10-14 19:28:41 +08:00
zeertzjq bcda800933 vim-patch:9.0.2022: getmousepos() returns wrong index for TAB char (#25636)
Problem:  When clicking in the middle of a TAB, getmousepos() returns
          the column of the next char instead of the TAB.
Solution: Break out of the loop when the vcol to find is inside current
          char. Fix invalid memory access when calling virtcol2col() on
          an empty line.

closes: vim/vim#13321

https://github.com/vim/vim/commit/b583eda7031b1f6a3469a2537d0c10ca5fa5568e
2023-10-14 19:18:25 +08:00
zeertzjqandYee Cheng Chin c40a1c0f41 vim-patch:9.0.2009: cmdline-completion for comma-separated options wrong (#25569)
Problem:  cmdline-completion for comma-separated options wrong
Solution: Fix command-line expansions for options with filenames with
          commas

Fix command-line expansions for options with filenames with commas

Cmdline expansion for option values that take a comma-separated list
of file names is currently not handling file names with commas as the
commas are not escaped. For such options, the commas in file names need
to be escaped (to differentiate from a comma that delimit the list
items). The escaped comma is unescaped in `copy_option_part()` during
option parsing.

Fix as follows:
- Cmdline completion for option values with comma-separated file/folder
  names will not start a new match when seeing `\\,` and will instead
  consider it as one value.
- File/folder regex matching will strip the `\\` when seeing `\\,` to
  make sure it can match the correct files/folders.
- The expanded value will escape `,` with `\\,`, similar to how spaces
  are escaped to make sure the option value is correct on the cmdline.

This fix also takes into account the fact that Win32 Vim handles file
name escaping differently. Typing '\,' for a file name results in it
being handled literally but in other platforms '\,' is interpreted as a
simple ',' and commas need to be escaped using '\\,' instead.

Also, make sure this new logic only applies to comma-separated options
like 'path'. Non-list options like 'set makeprg=<Tab>' and regular ex
commands like `:edit <Tab>` do not require escaping and will continue to
work.

Also fix up documentation to be clearer. The original docs are slightly
misleading in how it discusses triple slashes for 'tags'.

closes: vim/vim#13303
related: vim/vim#13301

https://github.com/vim/vim/commit/54844857fd6933fa4f6678e47610c4b9c9f7a091

Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2023-10-10 09:15:21 +08:00
zeertzjq f5eabaa940 fix(path): restore space separation in 'path' (#25571)
Removing this behavior causes more inconsistencies and bugs.
2023-10-10 08:22:32 +08:00
Maria José Solano c80a3976cb docs: miscellaneous doc and type fixes (#25554) 2023-10-10 06:34:48 +08:00
zeertzjq 92df389f1b vim-patch:27e12c7669e3
runtime(doc): remove E1520 tag (vim/vim#13289)

https://github.com/vim/vim/commit/27e12c7669e36a8f60fefa9db9a08024efeb06e8
2023-10-07 05:54:12 +08:00
zeertzjqandChrist van Willegen 8bb0878013 vim-patch:9.0.1990: strange error number
Problem:  strange error number
Solution: change error number,
          add doc tag for E1507

closes: vim/vim#13270

https://github.com/vim/vim/commit/ea746f9e862092aef3d4e95c64d116759b9fabe0

Co-authored-by: Christ van Willegen <cvwillegen@gmail.com>
2023-10-07 05:54:10 +08:00
Justin M. Keyes 29fe883aa9 feat: ignore swapfile for running Nvim processes #25336
Problem:
The swapfile "E325: ATTENTION" dialog is displayed when editing a file
already open in another (running) Nvim. Usually this behavior is
annoying and irrelevant:
- "Recover" and the other options ("Open readonly", "Quit", "Abort") are
  almost never wanted.
- swapfiles are less relevant for "multi-Nvim" since 'autoread' is
  enabled by default.
  - Even less relevant if user enables 'autowrite'.

Solution:
Define a default SwapExists handler which does the following:
1. If the swapfile is owned by a running Nvim process, automatically
   chooses "(E)dit anyway" (caveat: this creates a new, extra swapfile,
   which is mostly harmless and ignored except by `:recover` or `nvim -r`.
2. Shows a 1-line "ignoring swapfile..." message.
3. Users can disable the default SwapExists handler via `autocmd! nvim_swapfile`.
2023-10-04 06:31:25 -07:00
zeertzjqandYegappan Lakshmanan e0d669ffdb vim-patch:cd39b69b0200
runtime(doc): add missing error numbers in the help.  (vim/vim#13241)

closes: vim/vim#13240

https://github.com/vim/vim/commit/cd39b69b0200005622db7291bbacff95bd03a3d0

Co-authored-by: Yegappan Lakshmanan <4298407+yegappan@users.noreply.github.com>
2023-10-03 06:26:54 +08:00
zeertzjqanddundargoc 19b49b063c vim-patch:20f48d5b2ddb
runtime(doc): mention how to disable folding in diff mode (vim/vim#13242)

https://github.com/vim/vim/commit/20f48d5b2ddb9fdc29e83f0da6f31f895eaeab47

Co-authored-by: dundargoc <33953936+dundargoc@users.noreply.github.com>
2023-10-03 06:23:15 +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
Daniel Steinberg 2615ed879e feat(ui): allow to get the highlight namespace 2023-10-01 10:02:36 +02: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
zeertzjqandYegappan Lakshmanan 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

https://github.com/vim/vim/commit/413f83990f15d5d59d27ab741670f527a7a3feb8

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-09-29 06:52:02 +08:00
zeertzjq 86b7d8a9f5 vim-patch:5277cfaf8afe (#25397)
runtime(doc): mention mouse scrolling in scrollbind-quickadj (vim/vim#13190)

https://github.com/vim/vim/commit/5277cfaf8afe847b7d4dcde6057fbecb001ab64e
2023-09-28 05:22:09 +08: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
Maria José Solano 4db77017fb fix(meta): add nil return types to lpeg functions 2023-09-26 09:43:44 +02:00
Maria José Solano 5198a2555d fix(meta): cleanup lpeg operators 2023-09-26 09:43:44 +02:00
bfredl c3d1d9445c refactor(options)!: graduate some more shortmess flags
A lot of updated places in the docs were already incorrect since long
since they did not reflect the default behaviour.

"[dos format]" could've been argued being better for discoverability
but that ship has already sailed as it is no longer displayed by default.
2023-09-25 18:23:15 +02:00
bfredl ccd1a84a96 Merge pull request #25344 from gpanders/doc-shortmess
docs: remove "f" from default 'shortmess' value
2023-09-25 11:34:05 +02:00
Maria José Solano db51548036 docs: do not use deprecated functions #25334 2023-09-24 21:39:59 -07:00
zeertzjqanda5ob7r 57b84f6d64 vim-patch:790f9a890cee
runtime(doc): Add a missing '<' to the help of strutf16len() (vim/vim#13168)

https://github.com/vim/vim/commit/790f9a890ceeb9539776265cba0f026fb2c96790

Co-authored-by: a5ob7r <12132068+a5ob7r@users.noreply.github.com>
2023-09-25 06:38:38 +08:00
Maria José Solano f9944a78bc feat(meta): add types for vim.lpeg 2023-09-24 22:10:10 +02:00
Gregory Anders 6fb1e0d499 docs: remove "f" from default 'shortmess' value
The "f" flag was removed in f7da472257.
The value of the "f" flag is no longer listed in the 'shortmess'
description and it cannot be disabled, so having it in the default value
is pointless and confusing.
2023-09-24 09:09:18 -05:00
tj-moody 046c9a83f7 fix(ui): always use stl/stlnc fillchars when drawing statusline (#25267) 2023-09-24 10:49:47 +08:00
bfredl f7da472257 refactor(options)!: graduate shortmess+=f flag
Not everything needs to be crazy overconfigurable.

Also fixes a warning in latest clang which didn't approve of
the funky math switch statement in  append_arg_number
2023-09-23 18:13:05 +02:00