Commit Graph

392 Commits

Author SHA1 Message Date
dundargoc
693aea0e9e
docs: small fixes (#26448)
Co-authored-by: Gregory Anders <8965202+gpanders@users.noreply.github.com>
Co-authored-by: Jordan Mandel <jordan.mandel@live.com>
2023-12-19 13:29:13 +08:00
Amanda Graven
428edcde70
feat(api): add forward and back mouse buttons 2023-12-18 21:24:27 +01:00
Gregory Anders
8fb7419d7c
refactor: only reload colorscheme if &bg changed (#26598)
Currently, setting &bg at all re-initializes highlights and reloads
the active colorscheme, even if the actual value of &bg has not changed.
With https://github.com/neovim/neovim/pull/26595 this causes a
regression since &bg is set unconditionally based on the value detected
from the terminal.

Instead, only reload the colorscheme if the actual value of &bg has
changed.
2023-12-16 11:18:45 -06:00
Christian Clason
69f5f0e20e vim-patch:82f19734bfcb
runtime(doc): remove deprecation warning for gdefault

Deprecated can be misunderstood as being slated for removal; slightly
change wording to be clearer.

82f19734bf

Co-authored-by: dundargoc <gocdundar@gmail.com>
2023-12-16 15:57:22 +01:00
mathew
e38027ef69 feat(ui): completeopt support popup like vim 2023-12-16 18:59:59 +08:00
zeertzjq
165e5ececc
vim-patch:17dca3cb97cd (#26584)
runtime(doc): grammar & typo fixes

closes: vim/vim#13654

17dca3cb97

Co-authored-by: Dominique Pellé <dominique.pelle@tomtom.com>
2023-12-15 06:42:29 +08:00
Lewis Russell
97bea3163a feat(lsp): more annotations 2023-12-14 12:39:18 +00:00
Raphael
619407eb54
feat(nvim_open_term): convert LF => CRLF (#26384)
Problem:
Unlike termopen(), nvim_open_term() PTYs do not carriage-return the
cursor on newline ("\n") input.

    nvim --clean
    :let chan_id = nvim_open_term(1, {})
    :call chansend(chan_id, ["here", "are", "some", "lines"])

Actual behavior:

    here
        are
           some
               lines

Expected behaviour:

    here
    are
    some
    lines

Solution:
Add `force_crlf` option, and enable it by default.
2023-12-14 16:08:00 +08:00
Gregory Anders
08545bd45b
Merge pull request #26407 from gpanders/default-tgc
feat(defaults): enable 'termguicolors' by default when supported by terminal
2023-12-06 10:55:50 -08:00
Gregory Anders
2613ba5000 feat(defaults): enable 'termguicolors' by default when supported by terminal
Enable 'termguicolors' automatically when Nvim can detect that truecolor
is supported by the host terminal.

If $COLORTERM is set to "truecolor" or "24bit", or the terminal's
terminfo entry contains capabilities for Tc, RGB, or setrgbf and
setrgbb, then we assume that the terminal supports truecolor. Otherwise,
the terminal is queried (using both XTGETTCAP and SGR + DECRQSS). If the
terminal's response to these queries (if any) indicates that it supports
truecolor, then 'termguicolors' is enabled.
2023-12-06 07:57:09 -08:00
Emanuel
e057b38e70
fix(json): allow objects with empty keys #25564
Problem:
Empty string is a valid JSON key, but json_decode() treats an object
with empty key as ":help msgpack-special-dict". #20757

    :echo json_decode('{"": "1"}')
    {'_TYPE': [], '_VAL': [['', '1']]}

Note: vim returns `{'': '1'}`.

Solution:
Allow empty string as an object key.

Note that we still (currently) disallow empty keys in object_to_vim() (since 7c01d5ff92):
f64e4b43e1/src/nvim/api/private/converter.c (L333-L334)

Fix #20757

Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2023-12-06 07:56:04 -08:00
Riccardo Mazzarini
0b74ad0a64
refactor(api): complete conversion from Dictionary to Dict(opts) (#26365) 2023-12-05 19:33:57 +08:00
zeertzjq
a6cba103ce
refactor: move some constants out of vim_defs.h (#26298) 2023-11-29 20:32:40 +08:00
zeertzjq
aa9d9cafd0
vim-patch:9.0.2135: No test for mode() when executing Ex commands (#26282)
Problem:  No test for mode() when executing Ex commands
Solution: Add some test cases and simplify several other test cases.
          Also add a few more test cases for ModeChanged.

closes: vim/vim#13588

fcaeb3d42b
2023-11-29 06:51:00 +08:00
bfredl
ba564442ae
Merge pull request #26249 from bfredl/concealchar
feat(decoration): allow conceal_char to be a composing char
2023-11-28 11:01:21 +01:00
bfredl
ae3685798d feat(decoration): allow conceal_char to be a composing char
decor->text.str pointer must go. This removes it for conceal char,
in preparation for a larger PR which will also handle the sign case.

By actually allowing composing chars for a conceal chars, this
becomes a feature and not just a refactor, as a bonus.
2023-11-28 10:35:25 +01:00
zeertzjq
570367ac83
docs(lua): don't include remote-only API functions (#26266) 2023-11-28 13:52:17 +08:00
zeertzjq
e6d38c7dac
vim-patch:9.0.2133: Cannot detect overstrike mode in Cmdline mode (#26263)
Problem:  Cannot detect overstrike mode in Cmdline mode
Solution: Make mode() return "cr" for overstrike

closes: vim/vim#13569

d1c3ef1f47
2023-11-28 11:46:20 +08:00
Lewis Russell
84bbe4b0ca fix(lua): disallow vim.wait() in fast contexts
`vim.wait()` cannot be called in a fast callback since the main loop
cannot be run in that context as it is not reentrant

Fixes #26122
2023-11-27 09:09:21 +00: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
bfredl
df87266b23
Merge pull request #25724 from luukvbaal/signmerge
refactor(sign): move legacy signs to extmarks
2023-11-18 15:04:14 +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
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
Gregory Anders
b4b7ca2d54
feat(tui): support DCS responses in TermResponse event (#26061) 2023-11-16 11:12:42 -06: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
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
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
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
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

6a650bf696

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
dundargoc
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
zeertzjq
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

8ebdbc9e6d

Co-authored-by: dkearns <dougkearns@gmail.com>
2023-10-29 06:15:13 +08:00
zeertzjq
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

5985879e3c

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
zeertzjq
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

8079917447

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

6e6386716f

Co-authored-by: Illia Bobyr <illia.bobyr@gmail.com>
2023-10-18 06:08:14 +08:00
zeertzjq
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

8f4fb007e4

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

f5a94d5165
2023-10-15 17:19:01 +08:00
zeertzjq
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

47510f3d65

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
zeertzjq
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

2bbd0d30ee

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

b583eda703
2023-10-14 19:18:25 +08:00
zeertzjq
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

54844857fd

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)

27e12c7669
2023-10-07 05:54:12 +08:00
zeertzjq
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

ea746f9e86

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
zeertzjq
e0d669ffdb vim-patch:cd39b69b0200
runtime(doc): add missing error numbers in the help.  (vim/vim#13241)

closes: vim/vim#13240

cd39b69b02

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

20f48d5b2d

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
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
86b7d8a9f5
vim-patch:5277cfaf8afe (#25397)
runtime(doc): mention mouse scrolling in scrollbind-quickadj (vim/vim#13190)

5277cfaf8a
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
zeertzjq
57b84f6d64 vim-patch:790f9a890cee
runtime(doc): Add a missing '<' to the help of strutf16len() (vim/vim#13168)

790f9a890c

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
zeertzjq
c68c121f50
Merge pull request #25286 from rktjmp/doc-vim-schedule-wrap
docs: add more context to vim.schedule_wrap
2023-09-23 07:08:03 +08:00
Maria José Solano
dae6770b76 fix(meta): include vim.json 2023-09-22 23:02:45 +01:00
Oliver Marriott
44f698bb1a docs: update vim.schedule param name and type
Per https://github.com/neovim/neovim/pull/25286#discussion_r1332861721
and https://github.com/neovim/neovim/pull/25286#discussion_r1334318352
2023-09-23 01:54:24 +10: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
Justin M. Keyes
1b55f51d0d
docs: misc #24561
fix #24699
fix #25253
2023-09-20 04:15:23 -07: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
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
glepnir
fd08fd3de3 fix(float): add fixd option 2023-09-18 18:21:14 +08:00
Lewis Russell
b3342171d5 fix(typing): vim.fn.execute 2023-09-16 14:24:24 +01:00
Gregory Anders
2e92065686
docs: replace <pre> with ``` (#25136) 2023-09-14 08:23:01 -05:00
dundargoc
a6e74c1f0a
docs: fix typos and other small fixes (#25005)
Co-authored-by: nuid64 <lvkuzvesov@proton.me>
Co-authored-by: Mike Smith <10135646+mikesmithgh@users.noreply.github.com>
Co-authored-by: XTY <xty@xty.io>
Co-authored-by: Empa <emanuel@empa.xyz>
Co-authored-by: kyu08 <49891479+kyu08@users.noreply.github.com>
2023-09-14 12:05:27 +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
d22172f36b
fix(api): more intuitive cursor updates in nvim_buf_set_text
Fixes #22526
2023-09-11 08:16:03 +04:00
glepnir
8afb3a49c0 fix(highlight): add create param in nvim_get_hl 2023-09-09 17:15:58 +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
Jongwook Choi
da7178cbbf fix(builtin): fix incorrect optional fields for fn.sign_define
The field `icon` is not a mandatory field.
2023-08-30 07:51:26 +01:00
Lewis Russell
d3d7d763f3 feat(builtin): improve types 2023-08-27 13:07:04 +01:00
Maria José Solano
b7d5b55f74
fix(types): add some return/parameter type annotations (#24867)
* fix(types): add some return/parameter type annotations

* fix(types): narrow stdpath parameter further
2023-08-27 09:41:32 +01:00
Evgeni Chasnovski
986bf7e78d
feat(highlight): add FloatFooter highlight group
Problem: No clear separation of floating title and footer highlighting.

Solution: Add new `FloatFooter` highlight group.
2023-08-26 19:37:43 +03:00
Evgeni Chasnovski
35570e4a11
feat(float): implement footer
Problem: Now way to show text at the bottom part of floating window
  border (a.k.a. "footer").

Solution: Allows `footer` and `footer_pos` config fields similar to
  `title` and `title_pos`.
2023-08-26 19:37:43 +03:00
Alisue
b46e93c5fd
docs(msgpack_rpc): add "msgpack-rpc" client type 2023-08-26 19:14:07 +09:00
zeertzjq
b1cfb299df
docs: various clarifications (#24876) 2023-08-26 08:35:05 +08:00
Sean Dewar
daf7abbc42
docs(builtin): small fixes (#24861)
Also make gen_eval_files.lua render vimdoc helpExamples properly if the line
begins with the `>` marker.
2023-08-24 13:29:40 +01:00
Lewis Russell
21152f7905 fix(types): add more annotations to eval.lua 2023-08-23 12:16:04 +01:00
zeertzjq
09910d5b35 vim-patch:9.0.0837: append() reports failure when not appending anything
Problem:    append() reports failure when not appending anything.
Solution:   Only report failure when appending something. (closes vim/vim#11498)

cd9c8d400c

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-08-22 18:56:43 +08:00
zeertzjq
6bdfb890fd vim-patch:e46a44050562
Runtime file updates

e46a440505

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-08-21 17:24:54 +08:00
zeertzjq
0f48173ab5 vim-patch:589edb340454
Updte runtime files

589edb3404

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-08-21 17:16:10 +08:00
zeertzjq
7ce2acd59b vim-patch:8.1.2053: SafeStateAgain not triggered if callback uses feedkeys()
Problem:    SafeStateAgain not triggered if callback uses feedkeys().
Solution:   Check for safe state in the input loop.  Make log messages easier
            to find. Add 'S' flag to state().

d103ee7843

Include misc1.c change from patch 8.1.2062.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-08-21 14:16:16 +08:00
zeertzjq
64ccfdaafe vim-patch:8.1.2047: cannot check the current state
Problem:    Cannot check the current state.
Solution:   Add the state() function.

0e57dd859e

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-08-21 14:16:16 +08:00
zeertzjq
694814cdd5
vim-patch:9.0.1774: no support for custom cmdline completion (#24808)
Problem:  no support for custom cmdline completion
Solution: Add new vimscript functions

Add the following two functions:
- getcmdcompltype() returns custom and customlist functions

- getcompletion() supports both custom and customlist

closes: vim/vim#12228

92997dda78

Co-authored-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
2023-08-21 07:29:49 +08:00
zeertzjq
4c7df98e4e vim-patch:9.0.1515: reverse() does not work for a String
Problem:    reverse() does not work for a String.
Solution:   Implement reverse() for a String. (Yegappan Lakshmanan,
            closes vim/vim#12179)

03ff1c2dde

vim-patch:9.0.1738: Duplicate code to reverse a string

Problem:  Duplicate code to reverse a string
Solution: Move reverse_text() to strings.c and remove string_reverse().

closes: vim/vim#12847

4dd266cb66

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-08-19 18:05:46 +08:00
zeertzjq
f8afa8023e
vim-patch:9.0.1728: missing winid argument for virtcol() (#24770)
Problem: missing winid argument for virtcol()
Solution: Add a {winid} argument to virtcol()

Other functions col(), charcol() and virtcol2col() support a {winid}
argument, so it makes sense for virtcol() to also support than.

Also add test for virtcol2col() with 'showbreak' and {winid}.

closes: vim/vim#12633

825cf813fa
2023-08-18 08:42:45 +08:00
Sean Dewar
88887a7be7
docs(builtin): fix some missing lines (#24759)
Some things got chopped off in the PR that removed method syntax examples.
These were all that I found.
2023-08-17 16:38:56 +01:00
zeertzjq
6267996f13 vim-patch:8.2.4455: accepting one and zero for second sort() argument is strange
Problem:    Accepting one and zero for the second sort() argument is strange.
Solution:   Disallow using one and zero in Vim9 script.

2007dd49f5

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-08-17 16:11:17 +08:00
zeertzjq
b193674b4a vim-patch:partial:8.2.3849: functions implementing reduce and map are too long
Problem:    Functions implementing reduce and map are too long.
Solution:   Use a function for each type of value.  Add a few more test cases
            and add to the help. (Yegappan Lakshmanan, closes vim/vim#9370)

389b72196e

Partial port as this doesn't include handling for non-materialized List.

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-08-17 15:37:32 +08:00
zeertzjq
c5576fcc80 vim-patch:8.2.3848: cannot use reduce() for a string
Problem:    Cannot use reduce() for a string.
Solution:   Make reduce() work with a string. (Naruhiko Nishino, closes vim/vim#9366)

0ccb5842f5

Omit tv_get_first_char() as it doesn't really save much code.

Co-authored-by: rbtnn <naru123456789@gmail.com>
2023-08-17 15:20:47 +08:00
zeertzjq
d9e7dad139 vim-patch:8.2.3818: cannot filter or map characters in a string
Problem:    Cannot filter or map characters in a string.
Solution:   Make filter() and map() work on a string. (Naruhiko Nishino,
            closes vim/vim#9327)

c479ce032f

Co-authored-by: rbtnn <naru123456789@gmail.com>
2023-08-17 13:14:32 +08:00
zeertzjq
3117dc70f1 vim-patch:1b884a005398
Update runtime files.

1b884a0053

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-08-17 11:21:10 +08:00
zeertzjq
8cbb2477cf vim-patch:8.2.1969: Vim9: map() may change the list or dict item type
Problem:    Vim9: map() may change the list or dict item type.
Solution:   Add mapnew().

ea696852e7

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-08-17 11:21:10 +08:00
zeertzjq
a245dd79a2
vim-patch:9.0.1717: virtcol2col returns last byte of a multi-byte char (#24729)
Problem: virtcol2col returns last byte of a multi-byte char
Solution: Make it return the first byte for a multi-byte char

closes: vim/vim#12786
closes: vim/vim#12799

b209b86e66

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-08-16 06:28:52 +08:00
zeertzjq
842a47d6a4
vim-patch:9.0.1704: Cannot use positional arguments for printf() (#24719)
Problem: Cannot use positional arguments for printf()
Solution: Support positional arguments in string formatting

closes: vim/vim#12140

0c6181fec4

Co-authored-by: Christ van Willegen <cvwillegen@gmail.com>
2023-08-15 19:16:19 +08:00
zeertzjq
6c07a189f2
vim-patch:9.0.1688: cannot store custom data in quickfix list (#24673)
Problem: cannot store custom data in quickfix list
Solution: add `user_data` field for the quickfix list

closes: vim/vim#11818

ca6ac99077

Co-authored-by: Tom Praschan <13141438+tom-anders@users.noreply.github.com>
2023-08-12 08:19:06 +08:00
zeertzjq
6e0c36ba0e
vim-patch:9.0.1686: undotree() only works for the current buffer (#24665)
Problem:    undotree() only works for the current buffer
Solution:   Add an optional "buffer number" parameter to undotree().  If
            omitted, use the current buffer for backwards compatibility.

closes: vim/vim#4001
closes: vim/vim#12292

5fee111149

Co-authored-by: Devin J. Pohly <djpohly@gmail.com>
2023-08-12 05:51:49 +08:00
Justin M. Keyes
1d81d7a268
feat(defaults): treat "•" as a list item prefix #24623
Problem:
Nvim docs use "•" as a list item prefix but `gw{motion}` doesn't format
such lists by default.

Solution:
Change the 'comments' option to include "fb:•" by default.
2023-08-09 15:33:53 -07:00
Christian Clason
164370a4cb vim-patch:c2bd205254c8
Change "the" to "then" under ':help bufload()' (vim/vim#12662)

c2bd205254

N/A commits:
vim-patch:64dea84bb05a (we have our own manpager at home)
vim-patch:958e15bb1c7d (we have our own editorconfig syntax file)
vim-patch:c41b3c9f95ac (we don't have defaults.vim)

Co-authored-by: Daniel Steinberg <dstein64@users.noreply.github.com>
2023-08-09 20:43:45 +02:00
Sean Dewar
4134cebb17
docs(builtin): fix some missing lines (#24615)
These two functions seem to have previously had their docs start on the same
line as the signature, which I guess contributed to the lines being lost (though
I checked all other such functions from before again and these were the only
two).
2023-08-08 21:25:22 +01:00
bfredl
628763fbd8 docs(lua): the keyset nilocalypse
This is needed to give recent LuaLS the right idea about optional fields.
2023-08-08 10:42:59 +02:00
bfredl
3a21c3afe6
Merge pull request #24524 from bfredl/typed_keys
refactor(api): use typed keysets
2023-08-07 14:42:25 +02:00
bfredl
51c754b62e feat(lua): use keyset type information 2023-08-07 13:18:12 +02:00
Lewis Russell
6fa17da39b
docs(options): take ownership of options.txt (#24528)
* docs(options): take ownership of options.txt

- `src/nvim/options.lua` is now the source of truth
- generate runtime/lua/vim/_meta/options.lua

* fixup! zeer comments

* fixup! zeer comments (2)

* fixup! re-enable luacheck

* fixup! regen
2023-08-04 21:26:53 +01:00
Justin M. Keyes
b034378cf5
docs: luaref cleanup #24541
- drop "luaref-" prefix in favor of "lua-" or nothing, where possible.
- remove redundant "luaref--lang…" and "luaref-api…" tags.
2023-08-03 08:35:10 -07:00
Justin M. Keyes
d2f8133024 docs: misc
Co-authored-by: Kevin Pham <keevan.pham@gmail.com>
2023-08-03 14:01:53 +02:00
Marc Jakobi
4a06de40e7
docs(lua): fix generated fname param annotations #24533 2023-08-02 11:22:44 -07:00
zeertzjq
1ee905a63a
docs(builtin): fix alignment of comments in code blocks (#24529) 2023-08-02 22:14:32 +08:00
Justin M. Keyes
d086bc1e85
docs: drop "Can also be used as a method" #24508
Now that we "own" builtin.txt, we cant remove the repetitive mention of
Vimscript's UFCS syntax. It's noisy to mention this for each function,
and it's also not a Vimscript feature that should be encouraged.

Also change the builtin.txt heading to "NVIM REFERENCE MANUAL", which
indicates when a help file is Nvim-owned.
2023-08-01 16:17:26 -07:00
Lewis Russell
48d533272e
feat(lua-types): types for vim.api.* (#24523) 2023-08-01 14:20:44 +01:00
Lewis Russell
9b5f58185e
docs(builtin): fix and annotate language blocks (#24506) 2023-08-01 09:57:52 +01:00
altermo
2736cb3adf
docs(lua): vim.str_utf_{start,end,pos} #24424
Closes #24422
2023-07-29 07:08:32 -07:00
Lewis Russell
42333ea98d
feat(docs): generate builtin.txt (#24493)
- eval.lua is now the source of truth.

- Formatting is much more consistent.

- Fixed Lua type generation for polymorphic functions (get(), etc).

- Removed "Overview" section from builtin.txt
  - Can generate this if we really want it.

- Moved functions from sign.txt and testing.txt into builtin.txt.

- Removed the *timer* *timers* tags since libuv timers via vim.uv should be preferred.

- Removed the temp-file-name tag from tempname()

- Moved lueval() from lua.txt to builtin.txt.

* Fix indent

* fixup!

* fixup! fixup!

* fixup! better tag formatting

* fixup: revert changes no longer needed

* fixup! CI

---------

Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2023-07-28 14:48:41 +01:00
zeertzjq
ccf328172b
fix(gen_vimfn_types): don't include tag before signature's line (#24492)
When signature is a bit long or there are too many tags, the tags appear
before the signature's line. Don't include the line with tags in the
previous function' docs.

Also fix lint warnings.
2023-07-26 21:07:39 +08:00
Lewis Russell
fd089c8e50
feat(lua): typing for vim.fn.* (#24473)
Problem:
  No LSP information for `vim.fn.*`

Solution:
  Add meta file for `vim.fn.*`.
2023-07-26 09:50:54 +01:00
Gnik
cfcda91827
docs(lua): add missing word in docs for vim.empty_dict (#24401) 2023-07-22 15:42:25 +08:00
Lewis Russell
6e9b204afb fix: doc errors 2023-07-17 17:09:16 +01:00
Lewis Russell
69d49727d7 fix: luacheck 2023-07-17 16:32:56 +01:00
Lewis Russell
c2d7c2826c docs(lua): change *lua-foo* -> *vim.foo* 2023-07-17 16:25:29 +01:00
Lewis Russell
0ac3c4d631 docs(lua): move function docs to lua files 2023-07-17 16:25:28 +01:00