Commit Graph

5190 Commits

Author SHA1 Message Date
Mike
aa65bd478a
fix(startup): "nvim -l foo.lua" may not set arg0 #24161
Problem:
Using "nvim -l args.lua" without passing extra script args, does not set `_G.arg[0]`.

Steps to reproduce:
```
cat > args.lua<<EOF
vim.print(_G.arg, '')
vim.print(vim.v.argv, '')
EOF

nvim --clean -l args.lua
```

Solution:
Fix condition in command_line_scan.
2023-06-26 02:38:48 -07:00
zeertzjq
cd6458123f
fix(charset): fix wrong display of 0xffff (#24158) 2023-06-26 11:52:52 +08:00
Justin M. Keyes
5ceb2238d3
Merge #24116 from justinmk/doc 2023-06-25 09:17:47 -07:00
Justin M. Keyes
036da0d079 fix(docs): vimdoc syntax errors
gen_help_html: truncate parse-error sample text
2023-06-25 17:14:28 +02:00
zeertzjq
8182384205
test(extmarks): add a test for #23848 (#24140) 2023-06-24 22:15:13 +08:00
Ibby
31a51acdc3
fix(extmarks): fix heap buffer overflow caused by inline virtual text (#23851)
also fixes an edge case where the extends character would not be drawn if the real text exactly fits the grid.
2023-06-24 11:39:16 +01:00
zeertzjq
3688735c2b
fix(cmdline): don't redraw 'tabline' in Ex mode (#24123)
Redrawing of 'statusline' and 'winbar' are actually already inhibited by
RedawingDisabled in Ex mode.

In Vim there is a check for `msg_scrolled == 0` (which is false in Ex
mode) since Vim doesn't have msgsep. Add a `!exmode_active` check here
in Nvim instead.
2023-06-23 06:40:26 +08:00
Mathias Fußenegger
12c2c16acf
feat(lsp): opt-in to dynamicRegistration for inlay hints (#24102)
Since https://github.com/neovim/neovim/pull/23681 there is dynamic
registration support. We should use that for new features unless there
is a good reason to turn it off.
2023-06-22 19:39:57 +02:00
zeertzjq
f0884f21fa
feat(extmarks): support hl_mode "combine" for inline virt_text (#24099) 2023-06-22 20:39:35 +08:00
Justin M. Keyes
2f17ef1fc4
fix(messages): use "Vimscript" instead of "VimL" #24111
followup to #24109
fix #16150
2023-06-22 04:09:14 -07:00
Justin M. Keyes
4e6356559c
test: spellcheck :help (vimdoc) files #24109
Enforce consistent terminology (defined in
`gen_help_html.lua:spell_dict`) for common misspellings.

This does not spellcheck English in general (perhaps a future TODO,
though it may be noisy).
2023-06-22 03:44:51 -07:00
zeertzjq
f4f1ce1d16
fix(extmarks): hide inline virt_text properly with 'smoothscroll' (#24106) 2023-06-22 18:15:04 +08:00
zeertzjq
958cc22836
fix(extmarks): empty inline virt_text interfering with DiffText (#24101) 2023-06-22 17:48:53 +08:00
zeertzjq
a9cd8467cb fix(api): wrong nvim_buf_set_extmark error for invalid hl_mode 2023-06-22 15:04:46 +08:00
zeertzjq
0534ad8ca5 fix(extmarks): empty inline virt_text interfering with Visual highlight 2023-06-22 15:04:46 +08:00
zeertzjq
ded01a819a
fix(folds): don't show search or match highlighting on fold (#24084) 2023-06-21 18:28:12 +08:00
Justin M. Keyes
8d4a53fe6e
fix(vim.json)!: remove global options, "null", "array_mt" #24070
Problem:
- `vim.json` exposes various global options which:
  - affect all Nvim Lua plugins (especially the LSP client)
  - are undocumented and untested
  - can cause confusing problems such as: cc76ae3abe
- `vim.json` exposes redundant mechanisms:
  - `vim.json.null` is redundant with `vim.NIL`.
  - `array_mt` is redundant because Nvim uses a metatable
    (`vim.empty_dict()`) for empty dict instead, which `vim.json` is
    configured to use by default (see `as_empty_dict`).
    Example:
    ```
    :lua vim.print(vim.json.decode('{"bar":[],"foo":{}}'))
    --> { bar = {},  foo = vim.empty_dict() }
    ```
    Thus we don't need to also decorate empty arrays with `array_mt`.

Solution:
Remove the functions from the public vim.json interface.
Comment-out the implementation code to minimize drift from upstream.

TODO:
- Expose the options as arguments to `vim.json.new()`
2023-06-21 01:10:32 -07:00
Sooryakiran Ponnath
3bf887f6e0
fix(lsp): always return boolean in lsp.buf_client_attach (#24077)
Co-authored-by: Mathias Fussenegger <f.mathias@zignar.net>
2023-06-20 21:17:13 +02:00
Mathias Fußenegger
64f2691a98
refactor(lsp): extract common execute command functionality (#24065) 2023-06-20 18:36:18 +02:00
Chinmay Dalal
ca5de9306c
feat(lsp): inlay hints #23984
Add automatic refresh and a public interface on top of #23736

 * add on_reload, on_detach handlers in `enable()` buf_attach, and
  LspDetach autocommand in case of manual detach
* unify `__buffers` and `hint_cache_by_buf`
* use callback bufnr in `on_lines` callback, bufstate: remove __index override
* move user-facing functions into vim.lsp.buf, unify enable/disable/toggle

Closes #18086
2023-06-19 23:06:54 -07:00
Evgeni Chasnovski
8a7e3353eb
fix(fs): make normalize() work with '/' path (#24047)
Problem: Current implementation of "remove trailing /" doesn't
account for the case of literal '/' as path.
Solution: Remove trailing / only if it preceded by something else.

Co-authored by: notomo <notomo.motono@gmail.com>
2023-06-18 06:49:33 -05:00
Jonas Strittmatter
c07dceba33
fix(lsp): allow Lua pattern chars in code action filter (#24041)
Previously, filtering code actions with the "only" option failed
if the code action kind contained special Lua pattern chars such as "-"
(e.g. the ocaml language server supports a "type-annotate" code action).

Solution: use string comparison instead of string.find
2023-06-17 08:01:31 +02:00
zeertzjq
11060793d6 vim-patch:9.0.1635: error message is cleared when removing mode message
Problem:    Error message is cleared when removing mode message.
Solution:   Also reset flags when the message is further down.

da51ad51bf

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-06-16 08:55:05 +08:00
zeertzjq
cba07dad49 vim-patch:9.0.1634: message is cleared when removing mode message
Problem:    Message is cleared when removing mode message (Gary Johnson).
Solution:   Do not clear the command line after displaying a message.

800cdbb7ca

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-06-16 08:55:03 +08:00
zeertzjq
1f8fb7c000
fix(:let): fix error when applying operator to boolean option (#24030) 2023-06-15 12:36:21 +08:00
zeertzjq
d81f78713b
test(decorations_spec): add test for extmark case of #21486 (#24028) 2023-06-15 11:14:50 +08:00
zeertzjq
a05bbc60ea
fix(extmarks): don't position overlay virt_text halfway a char (#24027) 2023-06-15 09:03:39 +08:00
Jon Huhn
79a5b89d66
perf(lsp): reduce polling handles for workspace/didChangeWatchedFiles (#23500)
Co-authored-by: Lewis Russell <lewis6991@gmail.com>
2023-06-14 12:40:11 +02:00
zeertzjq
4c7cec4e29
fix(extmarks): handle inline virt_text with empty chunk (#24005) 2023-06-13 11:30:19 +08:00
zeertzjq
7abfb1f86e vim-patch:8.2.2949: tests failing because no error for float to string conversion
Problem:    Tests failing because there is no error for float to string
            conversion.
Solution:   Change the check for failure to check for correct result.  Make
            some conversions strict in Vim9 script.

3cfa5b16b0

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-06-12 13:27:16 +08:00
Justin M. Keyes
e688793253 feat: tostring(vim.version())
Problem:
tostring(vim.version()) returns "table: 0x…".

Solution:
Modify vim.version() to return a string prerelease instead of a boolean.

Fix #23863
2023-06-12 01:14:33 +02:00
treatybreaker
199a990c9e
feat: report "build" in vim.version() #23925
Problem:
Nvim version string typically has a "build" component
but vim.version() doesn't report it.

Solution:
Add the "build" field to vim.version().

Closes #23863
2023-06-11 14:57:23 -07:00
zeertzjq
bde59e8147
fix(remote): restore previous --remote-expr output formatting (#23988)
- Use tostring() as that's what print() uses internally.
- Do not append trailing new line.
2023-06-11 22:12:32 +08:00
Chinmay Dalal
643546b82b
feat(lsp): add handlers for inlay hints (#23736)
initial support; public API left for a follow-up PR
2023-06-11 11:53:37 +02:00
zeertzjq
cce9460524
fix(remote): make --remote-expr print to stdout (#23980) 2023-06-11 15:29:51 +08:00
zeertzjq
4229bbe514
fix(helptags): make multibyte help tags work properly (#23975) 2023-06-11 12:23:11 +08:00
zeertzjq
2237b384e4
vim-patch:9.0.1626: Visual area not shown when using 'showbreak' (#23978)
Problem:    Visual area not shown when using 'showbreak' and start of line is
            not visible. (Jaehwang Jung)
Solution:   Adjust "fromcol" for the space taken by 'showbreak'.
            (closes vim/vim#12514)

f578ca2c8f

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-06-11 11:29:39 +08:00
Mathias Fußenegger
302d3cfb96
feat(lua): use callable table as iterator in vim.iter (#23957)
A table passed to `vim.iter` can be a class instance with a `__call`
implementation for the iterator protocol.
2023-06-10 20:33:23 +02:00
zeertzjq
b6d2f49b45
test: more tests for nvim_{set,del}_keymap with abbreviation (#23970) 2023-06-10 10:44:31 +08:00
bfredl
42bbc4fabc feat(api): support abbreviations in nvim_set_keymap
closes #19198
2023-06-09 21:25:43 +02:00
Mathias Fußenegger
7c661207cc
feat(lua): add ringbuffer (#22894)
https://en.wikipedia.org/wiki/Circular_buffer
2023-06-08 12:11:24 +02:00
Lewis Russell
c0952e62fd
feat(lua): add vim.system()
feat(lua): add vim.system()

Problem:

  Handling system commands in Lua is tedious and error-prone:
  - vim.fn.jobstart() is vimscript and comes with all limitations attached to typval.
  - vim.loop.spawn is too low level

Solution:

  Add vim.system().
  Partly inspired by Python's subprocess module
  Does not expose any libuv objects.
2023-06-07 13:52:23 +01:00
Jonathon
0381f5af5b
feat(diff): grouping optimization for linematch algorithm 2023-06-07 13:29:23 +01:00
zeertzjq
dd24ea8195 fix(events): don't expand non-file as file name 2023-06-07 09:49:17 +08:00
zeertzjq
0e0a166a0c
refactor(api): adjust errors for setting options (#23942) 2023-06-07 09:00:55 +08:00
Gregory Anders
fcfe535e98
refactor(defaults): do not use C specific default values for options (#22500)
The options 'path', 'include', and 'define' all use C-specific default
values. This may have made sense a long time ago when Vim was mostly
used just for writing C, but this is no longer the case, and we have
ample support for filetype specific configuration. Make the default
values of these options empty and move the C-specific values into a
filetype plugin where they belong.

Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2023-06-06 11:26:29 -05:00
Alexandre Teoi
4382d2ed56
feat(health): fold successful healthchecks #22866
Problem:
checkhealth can be noisy, but we don't want to omit info.

Solution:
Fold OK results by default, if 'foldenable' is enabled.
Resolves #22796
2023-06-06 08:42:26 -07:00
Gianmaria Bajo
ca887b80a9
fix: version-range < and <= #23539
vim.version.range() couldn't parse them correctly.
For example, vim.version.range('<0.9.0'):has('0.9.0') returned `true`.

fix: range:has() accepts vim.version()
So that it's possible to compare a range with:

    vim.version.range(spec):has(vim.version())
2023-06-06 06:38:45 -07:00
zeertzjq
7b973c71ea
fix(statusline): redraw when VIsual_mode changes (#23933) 2023-06-06 19:24:42 +08:00
zeertzjq
eceb2dffce
fix(spell): splice extmarks on :spellrepall (#23929) 2023-06-06 10:32:30 +08:00
zeertzjq
9deef1aa22
vim-patch:9.0.1612: "skipcol" not reset when using multi-byte characters (#23928)
Problem:    "skipcol" not reset when using multi-byte characters.
Solution:   Compare with w_virtcol instead of w_cursor.col. (closes vim/vim#12457)

15d4747ffd

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-06-06 07:13:08 +08:00
zeertzjq
fc908b5006 vim-patch:9.0.1610: display is wrong when 'smoothscroll' is set
Problem:    Display is wrong when 'smoothscroll' is set and scrolling multiple
            lines.
Solution:   Redraw with UPD_NOT_VALID when "skipcol" is or was set.
            (closes vim/vim#12490, closes vim/vim#12468)

d9a92dc70b
2023-06-06 06:37:27 +08:00
zeertzjq
9978a9996d vim-patch:9.0.1603: display wrong if scrolling multiple lines with 'smoothscroll'
Problem:    Display wrong when scrolling multiple lines with 'smoothscroll'
            set.
Solution:   Redraw when w_skipcol changed. (closes vim/vim#12477, closes vim/vim#12468)

3c80227760
2023-06-06 06:37:23 +08:00
Gregory Anders
cbbda3bcd7
fix(editorconfig): check that buffer is valid (#23922)
Fixes: https://github.com/neovim/neovim/issues/23921
2023-06-05 11:53:13 -05:00
zeertzjq
a3fba5cafc
fix(mouse): handle folded lines with virt_lines attached to line above (#23912) 2023-06-05 17:11:58 +08:00
zeertzjq
16561dac39
test(core/startup_spec): add a test for #13720 (#23910) 2023-06-05 14:09:25 +08:00
Jon Huhn
416fe8d185
refactor(lsp): use LPeg for watchfiles matching (#23788) 2023-06-05 07:19:31 +02:00
Raphael
3c6d971e54
fix(lsp): set extra info only when it has a value (#23868) 2023-06-05 07:17:38 +02:00
zeertzjq
7955c90621 fix(plines): folded lines with virt_lines attached to line above 2023-06-05 08:45:32 +08:00
Folke Lemaitre
5282d3299c
fix(lsp): restore marks after apply_text_edits() #14630
PROBLEM:
Whenever any text edits are applied to the buffer, the `marks` part of those
lines will be lost. This is mostly problematic for code formatters that format
the whole buffer like `prettier`, `luafmt`, ...

When doing atomic changes inside a vim doc, vim keeps track of those changes and
can update the positions of marks accordingly, but in this case we have a whole
doc that changed. There's no simple way to update the positions of all marks
from the previous document state to the new document state.

SOLUTION:
* save marks right before `nvim_buf_set_lines` is called inside `apply_text_edits`
* check if any marks were lost after doing `nvim_buf_set_lines`
* restore those marks to the previous positions

TEST CASE:
* have a formatter enabled
* open any file
* create a couple of marks
* indent the whole file to the right
* save the file
Before this change: all marks will be removed.
After this change: they will be preserved.

Fixes #14307
2023-06-04 16:45:01 -07:00
zeertzjq
fdc8e966a9
fix(ui): don't send empty grid_line with redrawdebug=compositor (#23899) 2023-06-04 10:49:02 +08:00
zeertzjq
700cab0068
fix(events)!: trigger CursorMoved later on switching window (#23711) 2023-06-04 09:09:22 +08:00
zeertzjq
53f30de2be
vim-patch:9.0.1602: stray character visible if marker on top of double-wide char (#23897)
Problem:    Stray character is visible if 'smoothscroll' marker is displayed
            on top of a double-wide character.
Solution:   When overwriting a double-width character with the 'smoothscroll'
            marker clear the second half. (closes vim/vim#12469)

ecb87dd7d3
2023-06-04 07:39:05 +08:00
bfredl
72300feecf
Merge pull request #23864 from folke/nvim_win_set_height
fix(api): dont change curwin for nvim_win_set_height
2023-06-03 18:12:24 +02:00
zeertzjq
0e01e81552
fix(folds): allow overlay virtual text on folded line (#23892)
Also always check for fi_level before fi_lines.
2023-06-03 18:44:08 +08:00
Lewis Russell
2db719f6c2
feat(lua): rename vim.loop -> vim.uv (#22846) 2023-06-03 12:06:00 +02:00
zeertzjq
4b60267f82
feat(:source): source current ft=lua buffer as Lua code (#23802) 2023-06-02 21:00:55 +08:00
zeertzjq
9f3c4c1526
vim-patch:9.0.1597: cursor ends up below the window after a put (#23873)
Problem:    Cursor ends up below the window after a put.
Solution:   Mark w_crow and w_botline invalid when changing the cursor line.
            (closes vim/vim#12465)

8509014add

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-06-02 08:48:49 +08:00
Gregory Anders
fb54e6980e feat(lsp): set client offset_encoding if server supports positionEncoding
If the server sends the positionEncoding capability in its
initialization response, automatically set the client's offset_encoding
to use the value provided.
2023-06-01 11:34:23 -05:00
zeertzjq
afb70eba8c
Merge pull request #23789 from luukvbaal/spell
vim-patch:9.0.{1585,1595}
2023-06-01 21:29:14 +08:00
Luuk van Baal
ac1ad9651e vim-patch:9.0.1595: line pointer becomes invalid when using spell checking
Problem:    Line pointer becomes invalid when using spell checking.
Solution:   Call ml_get() at the right places. (Luuk van Baal, closes vim/vim#12456)

e84c773d42
2023-06-01 14:30:21 +02:00
Folke Lemaitre
68e7a6a6dc
test: added tests for set_height with winminheight=0 and a winbar 2023-06-01 12:23:42 +02:00
zeertzjq
2bdef6dd2a
fix(column): don't overflow sign column with extmark signs (#23854) 2023-06-01 16:20:31 +08:00
zeertzjq
7e3ff8afa4
test(extmarks): folding inline virt_text on empty line (#23847) 2023-05-31 06:50:37 +08:00
jdrouhard
58618d208a
feat(lsp)!: promote LspRequest to a full autocmd and enrich with additional data (#23694)
BREAKING CHANGE: LspRequest is no longer a User autocmd but is now a
first class citizen.

LspRequest as a User autocmd had limited functionality. Namely, the only
thing you could do was use the notification to do a lookup on all the
clients' requests tables to figure out what changed.

Promoting the autocmd to a full autocmd lets us set the buffer the
request was initiated on (so people can set buffer-local autocmds for
listening to these events).

Additionally, when used from Lua, we can pass additional metadata about
the request along with the notification, including the client ID, the
request ID, and the actual request object stored on the client's
requests table. Users can now listen for these events and act on them
proactively instead of polling all of the requests tables and looking
for changes.
2023-05-30 20:56:29 +02:00
luukvbaal
70da793c5e
fix(statusline): corrupted screen with minwid sign item in 'statuscolumn' (#23823) 2023-05-30 20:56:12 +08:00
zeertzjq
55f6a1cab0
vim-patch:9.0.1588: Incsearch not triggered when pasting clipboard register (#23817)
Problem:    Incsearch not triggered when pasting clipboard register on the
            command line.
Solution:   Also set "literally" when using a clipboard register. (Ken Takata,
            closes vim/vim#12460)

9cf6ab1332

Co-authored-by: K.Takata <kentkt@csc.jp>
2023-05-30 07:18:12 +08:00
zeertzjq
9dd48f7832
fix(substitute): properly check if preview is needed (#23809) 2023-05-29 08:44:52 +08:00
Ghjuvan Lacambre
5a3752889c
fix(NVIM_APPNAME): show error message if $NVIM_APPNAME is invalid
Closes https://github.com/neovim/neovim/issues/23056.
2023-05-28 16:04:54 +02:00
zeertzjq
9c41a81dec
fix(extmarks): fix virt_text_hide off-by-one hiding (#23795) 2023-05-28 17:29:44 +08:00
zeertzjq
4dd43e31db
fix(extmarks): don't show virt lines for end mark (#23792) 2023-05-28 17:22:25 +08:00
zeertzjq
f29acc5073
test(extmarks): add tests for #14201 #20004 #20885 (#23794) 2023-05-28 16:28:10 +08:00
Folke Lemaitre
ddd92a70d2
feat(lsp): initial support for dynamic capabilities (#23681)
- `client.dynamic_capabilities` is an object that tracks client register/unregister
- `client.supports_method` will additionally check if a dynamic capability supports the method, taking document filters into account. But only if the client enabled `dynamicRegistration` for the capability
- updated the default client capabilities to include dynamicRegistration for:
    - formatting
    - rangeFormatting
    - hover
    - codeAction
    - hover
    - rename
2023-05-28 07:51:28 +02:00
zeertzjq
e41b2e34b4
test(extmarks): add test for virt_text_hide with 'smoothscroll' (#23791) 2023-05-28 11:09:25 +08:00
zeertzjq
510e1f131b
fix(extmarks): make right_align and win_col work on wrapped line (#23759) 2023-05-27 21:36:16 +08:00
bfredl
68da87d2e7
Merge pull request #23742 from bfredl/neolight
fix(drawline): combine extmark highlight with area hl correctly
2023-05-26 11:48:05 +02:00
bfredl
a92d78d201
Merge pull request #23583 from zeertzjq/ui-attach-title
fix(ui-ext): send title to newly-attached UI
2023-05-26 11:29:56 +02:00
zeertzjq
a6dd67f5b6
fix(extmarks): fix virt_text_hide with 'nowrap' and multibyte (#23757) 2023-05-26 10:41:19 +08:00
luukvbaal
f733595e79
vim-patch:9.0.1578: SpellCap highlight not always updated when needed (#23755)
Problem:    SpellCap highlight not always updated when needed.
Solution:   Handle updating line below closed fold and other situations where
            only part of the window is redrawn. (Luuk van Baal, closes vim/vim#12428,
            closes vim/vim#12420)

2ac6497f0e
2023-05-26 08:08:18 +08:00
zeertzjq
43d66c0ebb fix(ui-ext): send title to newly-attached UI 2023-05-26 07:46:24 +08:00
bfredl
455bca1ba8 fix(drawline): combine extmark highligh with area hl correctly
fixes #23734

Get rid of the weird attr_pri dance which always seemed like a kludge:

    if (!attr_pri) {
      wlv.char_attr = hl_combine_attr(wlv.char_attr, extmark_attr);
    } else {
      wlv.char_attr = hl_combine_attr(extmark_attr, wlv.char_attr);
    }

Instead combine extmark attrs with (old-skool) syntax attrs in a consistent way and then combine that with attr_pri and the rest in an _unified_ code path

fixes #23722

Co-authored-by: luukvbaal <luukvbaal@gmail.com>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2023-05-25 18:40:26 +02:00
zeertzjq
ee986ee044
fix(folds): combined Folded and Visual highlights (#23752)
Also combine high-priority CursorLine with Folded.
2023-05-25 22:14:12 +08:00
Luuk van Baal
50efdd6ccf vim-patch:9.0.0664: bad redrawing with spell checking, using "C" and "$" in 'cpo'
Problem:    Bad redrawing with spell checking, using "C" and "$" in 'cpo'.
Solution:   Do not redraw the next line when "$" is in 'cpo'. (closes vim/vim#11285)

f3ef026c98

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-05-25 11:24:22 +02:00
Luuk van Baal
d2dc7cfa5b vim-patch:9.0.0608: with spelling, deleting a full stop does not update next line
Problem:    With spell checking, deleting a full stop at the end of a line
            does not update SpellCap at the start of the next line.
Solution:   Update the next line when characters have been deleted.  Also when
            using undo.

26f09ea54b

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-05-25 11:24:22 +02:00
Luuk van Baal
ad7cded1f3 vim-patch:9.0.0590: after exiting Insert mode spelling not checked in next line
Problem:    After exiting Insert mode spelling is not checked in the next
            line.
Solution:   When spelling is enabled redraw the next line after exiting Insert
            mode in case the spell highlight needs updating.

ee09fcc9b6

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-05-25 11:24:19 +02:00
Luuk van Baal
bff67c9fbe vim-patch:9.0.0175: spell checking for capital not working with trailing space
Problem:    Spell checking for capital not working with trailing space.
Solution:   Do not calculate cap_col at the end of the line. (Christian
            Brabandt, closes vim/vim#10870, issue vim/vim#10838)

afa23d1b99

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-05-25 01:13:47 +02:00
zeertzjq
678548a2b4
fix(folds): show Folded highlight in Visual selection (#23741)
Note: CursorLine highlight is now combined with Folded.
2023-05-24 21:25:39 +08:00
Christian Clason
c855eee919
feat(term): enable reflow by default (#21124)
libvterm v0.3 supports reflow of terminal buffer when Nvim is resized
Since v0.3 is now a required dependency, enable it by default to find
(and fix) possible issues.

Note: Neovim's scrollback buffer does not support reflow (yet), so lines
vanishing into the buffer due to a too small window will be restored
without reflow.
2023-05-24 10:04:49 +02:00
zeertzjq
62e0e0349c
fix(colorscheme): try .lua files in 'rtp' before .vim files in 'pp' (#23727)
This ensures that colorschemes in 'rtp' are tried before ones in 'pp',
because some colorschemes in 'pp' may not work if not added to 'rtp'.

This also match the current documentation better.
2023-05-23 16:12:16 +08:00
bfredl
07883940b2
Merge pull request #20130 from bfredl/inline
feat(ui): inline virtual text
2023-05-22 14:16:42 +02:00
bfredl
c5528e7fd8 fix(test): clean up inline virtual text tests a little 2023-05-22 13:49:42 +02:00
bfredl
a78fd18ed9 fix(extmark): fix cursor position with both left and right gravity inline text 2023-05-22 13:49:42 +02:00
Ibby
a37c990483 fix(ui): fix overflowing nowrap virtual text not displaying if tab follows 2023-05-22 13:49:42 +02:00
Ibby
34d862942c fix(ui): fix virtual text not displaying when two overlapping inlines (nowrap) 2023-05-22 13:49:42 +02:00
Ibby
5547b16c40 vim-patch:9.0.1067: in diff mode virtual text is highlighted incorrectly
Problem:    In diff mode virtual text is highlighted incorrectly. (Rick Howe)
Solution:   Do not use diff attributes for virtual text. (closes vim/vim#11714)

d097af7779

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-05-22 13:49:42 +02:00
Ibby
75f350aac6 fix(ui): fix incorrect highlighting when virtual text next to match 2023-05-22 13:49:42 +02:00
Ibby
332b70d2ed fix(ui): fix incorrect highlighting when virtual text wraps with number 2023-05-22 13:49:42 +02:00
Ibby
ecf225df57 vim-patch:9.0.0944: 'cursorline' causes virtual text highlight to continue
Problem:    'cursorline' causes virtual text highlight to continue.
Solution:   Save and restore line_attr. (closes vim/vim#11588)

6ac16f0c0f

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-05-22 13:49:42 +02:00
Ibby
5d7afb2e9f fix(ui): fix tabs not being spaced properly after virtual text with no wrap
also fixes incorrect skipping of multibyte characters
2023-05-22 13:49:42 +02:00
Ibby
7423d3479d vim-patch:9.0.0716: with 'nowrap' virtual text "after" does not scroll left
Problem:    With 'nowrap' virtual text "after" does not scroll left.
Solution:   Skip part of the virtual text that is left of the window.
            (closes vim/vim#11320)  Fix going beyond the last column of the window.

cd105417a5

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-05-22 13:49:42 +02:00
Ibby
1936285d98 fix(ui): fixes incorrect rendering when virtual text is not visable and nowrap 2023-05-22 13:49:42 +02:00
Ibby
be273c3a23 vim-patch:9.0.0205: cursor in wrong position when inserting after virtual text
Problem:    Cursor in wrong position when inserting after virtual text. (Ben
            Jackson)
Solution:   Put the cursor after the virtual text, where the text will be
            inserted. (closes vim/vim#10914)

28c9f89571

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-05-22 13:49:42 +02:00
Ibby
c5bf838f8a fix(ui): fix visual and search highlighting interfering with virtual text
vim-patch:9.0.0193: search and match highlgith interfere with virtual text

Problem:    Search and match highlgith interfere with virtual text highlight.
            (Ben Jackson)
Solution:   Check for match highlight after text properties.  Reset and
            restore search highlight when showing virtual text.
            (closes vim/vim#10892)

e38fc86180

vim-patch:9.0.0452: Visual highlighting extends into virtual text prop

Problem:    Visual highlighting extends into virtual text prop.
Solution:   Do not highlight what isn't actually selected.  Fix ordering of
            stored text props.

6eda17d881

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-05-22 13:49:42 +02:00
Ibby
e12b5882af vim-patch:9.0.0183: extra space after virtual text when 'linebreak' is set
Problem:    Extra space after virtual text when 'linebreak' is set.
Solution:   Do not count virtual text when getting linebreak value.
            (closes vim/vim#10884)

52de3a8d39

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-05-22 13:49:42 +02:00
Ibby
dee3af2122 vim-patch:9.0.0178: cursor position wrong with virtual text before Tab
Problem:    Cursor position wrong with virtual text before Tab.
Solution:   Use the byte length, not the cell with, to compare the column.
            Correct tab size after text prop. (closes vim/vim#10866)

e428fa04a7

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-05-22 13:49:42 +02:00
Ibby
43c2eaada2 vim-patch:9.0.0179: cursor pos wrong with wrapping virtual text in empty line
Problem:    Cursor position wrong with wrapping virtual text in empty line.
Solution:   Adjust handling of an empty line. (closes vim/vim#10875)

49a90792d9

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-05-22 13:49:42 +02:00
Ibby
8eaf3c4f8c vim-patch:9.0.0143: cursor positioned after virtual text in empty line
Problem:    Cursor positioned after virtual text in empty line.
Solution:   Keep cursor in the first column. (closes vim/vim#10786)

afd2aa79ed
2023-05-22 13:49:42 +02:00
Ibby
0c7fa3bdcc fix(ui): fix multi-byte characters highlight in virtual text
This also fixes insert cursor position around virtual text

vim-patch:9.0.0132: multi-byte characters in virtual text not handled correctly

Problem:    Multi-byte characters in virtual text not handled correctly.
Solution:   Count screen cells instead of bytes.

09ff4b54fb
2023-05-22 13:49:42 +02:00
Ibby
389f5ca39d fix(ui): adjust the cursor when inserting virtual text
Credit to: Jesse Bakker

https://github.com/neovim/neovim/pull/20130#issuecomment-1369652743

Co-authored-by: Jesse Bakker <github@jessebakker.com>
2023-05-22 13:49:42 +02:00
Ibby
a38d7f9984 fix(ui): fix cursor position with multiple inline virtual text
vim-patch9.0.0121: cannot put virtual text after or below a line

Problem:    Cannot put virtual text after or below a line.
Solution:   Add "text_align" and "text_wrap" arguments.

b7963df98f

This only patches the fix, not the whole thing.
2023-05-22 13:49:42 +02:00
Ibby
efa9b299a7 feat(ui): inline virtual text
vim-patch:9.0.0067: cannot show virtual text

Problem:    Cannot show virtual text.
Solution:   Initial changes for virtual text support, using text properties.

7f9969c559

vim-patch:9.0.0116: virtual text not displayed if 'signcolumn' is "yes"

Problem:    Virtual text not displayed if 'signcolumn' is "yes".
Solution:   Set c_extra and c_final to NUL.
711483cd13

Co-authored-by: bfredl <bjorn.linse@gmail.com>
2023-05-22 13:49:42 +02:00
zeertzjq
cb34d0ddd0
fix(redraw): overwrite double-width char with virt_text properly (#23708) 2023-05-22 18:22:47 +08:00
luukvbaal
b11a8c1b5d
fix(highlight): remove unnecessary assignment to char_attr for 'spell' (#23713) 2023-05-22 17:07:55 +08:00
Null Chilly
b7708eac24
fix(api): nvim_get_hl should return default flag 2023-05-22 09:49:01 +01:00
Famiu Haque
576dddb461 test: don't unnecessarily specify win/buf for nvim_(get|set)_option_value
`nvim_(get|set)_option_value` pick the current buffer / window by default for buffer-local/window-local (but not global-local) options. So specifying `buf = 0` or `win = 0` in opts is unnecessary for those options. This PR removes those to reduce code clutter.
2023-05-22 13:02:07 +06:00
bfredl
384a3bc308
Merge pull request #23670 from famiu/refactor/deprecate_opt_api
refactor(options): deprecate nvim[_buf|_win]_[gs]et_option
2023-05-21 20:16:05 +02:00
luukvbaal
60f69014a8
fix(redraw): multibyte characters are wrapped at the end of a line (#23696)
Problem:    Multibyte characters may be wrapped at the end of a line
            when 'statuscolumn' and 'spell' are set.
Solution:   Update line pointerdiff "v" before fetching the line pointer
            after evaluating 'statuscolumn'.
2023-05-21 19:00:37 +08:00
Lewis Russell
1fe1bb084d refactor(options): deprecate nvim[_buf|_win]_[gs]et_option
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Co-authored-by: famiu <famiuhaque@protonmail.com>
2023-05-21 15:14:01 +06:00
Christian Clason
e3e6fadfd8
feat(fs): expose join_paths as vim.fs.joinpath (#23685)
This is a small function but used a lot in some plugins.
2023-05-20 17:30:48 +02:00
Jon Huhn
073035a030
fix(lsp): don't register didChangeWatchedFiles when capability not set (#23689)
Some LSP servers (tailwindcss, rome) are known to request registration
for `workspace/didChangeWatchedFiles` even when the corresponding client
capability does not advertise support. This change adds an extra check
in the `client/registerCapability` handler not to start a watch unless
the client capability is set appropriately.
2023-05-20 07:45:39 +02:00
Luuk van Baal
cf0f83ebf0 vim-patch:9.0.1568: with 'smoothscroll' cursor may move below botline
Problem:    With 'smoothscroll' cursor may move below botline.
Solution:   Call redraw_later() if needed,  Compute cursor row with adjusted
            condition. (Luuk van Baal, closes vim/vim#12415)

d49f646bf5
2023-05-19 19:28:01 +02:00
Luuk van Baal
02ef104d5b vim-patch:9.0.1564: display moves up and down with 'incsearch' and 'smoothscroll'
Problem:    Display moves up and down with 'incsearch' and 'smoothscroll'.
Solution:   Do not check if w_skipcol changed. (Luuk van Baal, closes vim/vim#12410,
            closes vim/vim#12409)

0222c2d103
2023-05-19 18:42:23 +02:00
dundargoc
826b95203a
build: bundle uncrustify
Uncrustify is sensitive to version changes, which causes friction for
contributors that doesn't have that exact version. It's also simpler to
download and install the correct version than to have bespoke version
checking.
2023-05-18 16:27:47 +02:00
zeertzjq
c9f47fca8b
fix(messages): ensure msg_grid is at top at more prompt (#23584) 2023-05-17 21:06:27 +08:00
Lewis Russell
6b19170d44
fix(treesitter): correctly calculate bytes for text sources (#23655)
Fixes #20419
2023-05-16 16:41:47 +01:00
luukvbaal
5887ecab6d
vim-patch:9.0.1561: display wrong when moving cursor to above the top line (#23644)
Problem:    Display wrong when moving cursor to above the top line and
            'smoothscroll' is set.
Solution:   Call adjust_skipcol() in more places and make it work better.
            (Luuk van Baal, closes vim/vim#12395)

798fa76dbf
2023-05-16 07:56:06 +08:00
Christian Clason
9ff59517cb fix(treesitter): update c queries 2023-05-15 14:13:42 +02:00
dundargoc
ecd6d679a0
test: skip flaky test on Windows 2023-05-14 14:29:18 +02:00
luukvbaal
5825d2f6ca
test(scroll_opt): fix typo in porting oldtest (#23593) 2023-05-12 08:17:38 +08:00
zeertzjq
d6e898b44f
Merge pull request #23558 from luukvbaal/smoothscroll
vim-patch:9.0.{1530,1533,1542,1543}
2023-05-12 07:24:13 +08:00
Luuk van Baal
6f41eaa2b5 vim-patch:9.0.1543: display errors when making topline shorter
Problem:    Display errors when making topline shorter and 'smoothscroll' is
            set.
Solution:   Reset w_skipcol when the topline becomes shorter than its current
            value. (Luuk van Baal, closes vim/vim#12367)

5d01f86d99
2023-05-11 20:57:36 +02:00
Luuk van Baal
15c684b358 vim-patch:9.0.1542: line not fully displayed if it doesn't fit in the screen
Problem:    Line not fully displayed if it doesn't fit in the screen.
Solution:   Do not reset s_skipcol if not needed. (Luuk van Baal,
            closes vim/vim#12376)

6c018680be
2023-05-11 20:57:31 +02:00
zeertzjq
03ca36d1f8
fix(highlight): apply 'winblend' to NormalNC (#23555) 2023-05-10 23:46:50 +08:00
zeertzjq
5ac2e47acc
fix(redo): make redo of Lua mappings in op-pending mode work (#23566) 2023-05-10 17:42:14 +08:00
Luuk van Baal
d5780e133a vim-patch:9.0.1533: test for 'smoothscroll' is ineffective
Problem:    Test for 'smoothscroll' is ineffective.
Solution:   Change the order of testing "zb" and "zt". (Luuk van Baal,
            closes vim/vim#12366)

6f37e530d3
2023-05-09 22:53:08 +02:00
Luuk van Baal
1caad791b4 vim-patch:9.0.1530: cursor moves to wrong line when 'foldmethod' is "diff"
Problem:    Cursor moves to wrong line when 'foldmethod' is "diff". (Rick
            Howe)
Solution:   Adjust logic for scrolling. (Luuk van Baal, closes vim/vim#12364,
            closes vim/vim#12218)

aa6ba308a1
2023-05-09 22:40:24 +02:00
zeertzjq
36baaf7c1a
test: move most title tests to a separate file (#23557)
This avoids running title tests twice unnecessarily.
2023-05-10 00:14:54 +08:00
Jon Huhn
075a72d5ff
fix(lsp): fix relative patterns for workspace/didChangeWatchedFiles (#23548) 2023-05-09 18:12:54 +02:00
luukvbaal
44fc2a6d7e
vim-patch:9.0.1525: 'smoothscroll' does not always work properly (#23544)
Problem:    'smoothscroll' does not always work properly.
Solution:   Do not reset w_skipcol after it was intentionally set.  (Luuk van
            Baal, closes vim/vim#12360, closes vim/vim#12199, closes vim/vim#12323)

3ce8c38915
2023-05-09 07:44:31 +08:00
zeertzjq
4ecf6fdfd8
fix(statusline): bail out properly on negative row (#23535) 2023-05-08 16:25:03 +08:00