Commit Graph

27172 Commits

Author SHA1 Message Date
zeertzjq
61ecb3e16c
fix(provider/pythonx): import the correct module (#25342) 2023-09-24 22:04:29 +08:00
zeertzjq
ed0d6536e3
test: only trim trailing spaces in swapfile tests (#25341) 2023-09-24 22:03:54 +08:00
zeertzjq
9637b7dae4
fix(startup): stop TUI properly when quitting at swap dialog (#25337) 2023-09-24 16:29:07 +08:00
zeertzjq
ac1c23442f
test(old): don't set options to default before every test (#25335)
Oldtests clean up after themselves, and the options that need operators
to align with Vim all deny duplicates, so there is no need to set them
to default.

Also make the variable name that test_listchars.vim uses to align with
Vim more obvious.
2023-09-24 11:20:23 +08:00
dundargoc
9f58867935 refactor(clang-tidy): ignore warnings from clang-tidy 17 2023-09-24 04:58:49 +02:00
zeertzjq
4d3a38ac07
fix(api, lua): handle setting v: variables properly (#25325) 2023-09-24 10:57:09 +08:00
tj-moody
046c9a83f7
fix(ui): always use stl/stlnc fillchars when drawing statusline (#25267) 2023-09-24 10:49:47 +08:00
zeertzjq
cfb898cd8a
test(tui_spec): small consistency fixes (#25332)
- Make indent consistent.
- Remove outdated "Only single integration test" comment.
- Don't use setup() as function name as it's used by busted.
2023-09-24 08:05:18 +08:00
Maria José Solano
bc0bf9d030 docs: fix type warnings 2023-09-23 23:46:45 +01:00
bfredl
01be28b370
Merge pull request #25330 from bfredl/no_shm_f
refactor(options)!: graduate shortmess+=f flag
2023-09-23 21:18:06 +02:00
bfredl
93d27ea578
Merge pull request #25268 from bfredl/grid_line
refactor(grid): properly namespace and separate stateful grid functions
2023-09-23 18:29:19 +02: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
fcdfbb4303
fix(float): fix some other crashes with :unhide or :all (#25328) 2023-09-23 22:33:44 +08:00
Jongwook Choi
7bd6bd1ef7
fix(provider): cannot detect python3.12 #25316
PROBLEM: The builtin python3 provider cannot auto-detect python3.12
when g:python3_host_prog is not set. As a result, when python3 on $PATH
is currently python 3.12, neovim will fail to load python3 provider
and result in `has("python3") == 0`, e.g.,
"Failed to load python3 host. You can try to see what happened by ..."

ROOT CAUSE: the `system()` call from `provider#pythonx#DetectByModule`
does not ignore python warnings, and `pkgutil.get_loader` will print
a warning message in the very first line:
```
<string>:1: DeprecationWarning: 'pkgutil.get_loader' is deprecated and
slated for removal in Python 3.14; use importlib.util.find_spec() instead
```

SOLUTION:
- Use `importlib.util.find_spec` instead (python >= 3.4)
- Use `-W ignore` option to prevent any potential warning messages
2023-09-23 02:49:34 -07:00
Christian Clason
b8103eece3 build(deps): bump luajit to HEAD - 97c75843c 2023-09-23 10:46:43 +02:00
zeertzjq
5331d5772f
fix(lua): show error message when failing to set variable (#25321) 2023-09-23 15:59:37 +08:00
zeertzjq
c0a29931e2
fix(unhide): close floating windows first (#25318) 2023-09-23 14:42:59 +08:00
zeertzjq
c88bb658ce
vim-patch:8.2.4609: :unhide does not check for failing to close a window (#25317)
Problem:    :unhide does not check for failing to close a window.
Solution:   When closing a window fails continue with the next one.  Do not
            try closing the autocmd window. (closes vim/vim#9984)

6f2465d336

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-09-23 12:41:09 +08:00
zeertzjq
c26b39a9aa
fix(tui): make :cquit work properly with remote TUI (#25313) 2023-09-23 11:00:20 +08:00
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
L Lllvvuu
e353c869ce fix(languagetree): don't treat unparsed nodes as occupying full range
This is incorrect in the following scenario:
1. The language tree is Lua > Vim > Lua.
2. An edit simultaneously wipes out the `_regions` of all nodes, while
   taking the Vim injection off-screen.
3. The Vim injection is not re-parsed, so the child Lua `_regions` is
   still `nil`.
4. The child Lua is assumed, incorrectly, to occupy the whole document.
5. This causes the injections to be parsed again, resulting in Lua > Vim
   > Lua > Vim.
6. Now, by the same process, Vim ends up with its range assumed over the
   whole document. Now the parse is broken and results in broken
   highlighting and poor performance.

It should be fine to instead treat an unparsed node as occupying
nothing (i.e. effectively non-existent). Since, either:
- The parent was just parsed, hence defining `_regions`
- The parent was not just parsed, in which case this node doesn't need
  to be parsed either.

Also, the name `has_regions` is confusing; it seems to simply
mean the opposite of "root" or "full_document". However, this PR does
not touch it.
2023-09-22 12:51:51 +01:00
bfredl
3a7cb72dcb refactor(grid): properly namespace and separate stateful grid functions
This is a step in an ongoing refactor where the "grid_puts" and
"grid_put_linebuf" code paths will share more of the implementation (in
particular for delta calculation, doublewidth and 'arabicshape'
handling). But it also makes sense by its own as a cleanup, and is thus
committed separately.

Before this change many of the low level grid functions grid_puts,
grid_fill etc could both be used in a standalone fashion but also as
part of a batched line update which would be finally transmitted as a
single grid_line call (via ui_line() ). This was initially useful to
quickly refactor pre-existing vim code to use batched logic safely.

However, this pattern is not really helpful for maintainable and newly
written code, where the "grid" and "row" arguments are just needlessly
repeated. This simplifies these calls to just use grid and row as
specified in the initial grid_line_start(grid, row) call.

This also makes the intent clear whether any grid_puts() call is actually
part of a batch or not, which is better in the long run when more things
get refactored to use effective (properly batched) updates.
2023-09-22 13:48:46 +02:00
zeertzjq
b7763d7f6b
fix(api): get virtual text with multiple hl properly (#25307) 2023-09-22 17:56:05 +08:00
Oliver Marriott
f413597f44 docs: clarify vim.schedule_wrap behaviour
- Remove the usage of the term "defer" to avoid confusion with
  `vim.defer_fn`, which also calls `vim.schedule_wrap` internally.
- Explicitly state that `vim.schedule_wrap` returns a function in the
  text.
- Mention that arguments are passed along.
- Include a usage example.
- Rename param to `fn`.
2023-09-22 18:38:28 +10:00
zeertzjq
64e8a3c4d1
fix(ui): handle virtual text with multiple hl in more cases (#25304) 2023-09-22 15:36:24 +08:00
zeertzjq
34a786bc49
fix(extmarks): inline virt_text support multiple hl groups (#25303) 2023-09-22 14:21:58 +08:00
zeertzjq
fcfc87cb77
docs: small improvements to compl-autocomplete example (#25299)
- Don't complete when there is pending input.
- Use vim.list_contains() instead of vim.tbl_contains().
2023-09-22 06:51:47 +08:00
zeertzjq
6555176f34
vim-patch:9.0.1923: curswant wrong on click with 've' and 'nowrap' set (#25293)
Problem:  curswant wrong on click with 've' and 'nowrap' set
Solution: Add w_leftcol to mouse click column.

closes: vim/vim#13142

db54e989b5
2023-09-22 05:44:45 +08:00
dundargoc
c1ff216668 build: actually export symbols on mac
If `-export_dynamic` is not passed to the linker, then Link Time
Optimization may inline and remove global functions even though
ENABLE_EXPORTS is set to true.

Closes https://github.com/neovim/neovim/issues/25295.
Closes https://github.com/kevinhwang91/nvim-ufo/issues/162.
Closes https://github.com/neovim/neovim/issues/25295.

Co-authored-by: Carlo Cabrera <30379873+carlocab@users.noreply.github.com>
2023-09-21 22:08:13 +02:00
bfredl
5e43a4ce4d
Merge pull request #25288 from bfredl/tuiassert
fix(tui): don't overwrite an assertion faliure message on exit
2023-09-21 12:58:25 +02:00
Sergey Slipchenko
345bd91db2
fix(lsp): handle absence of a trailing newline #25194
Fixes #24339

rust-analyzer sends "Invalid offset" error in such cases. Some other
servers handle it specially.

LSP spec mentions that "A range is comparable to a selection in an
editor". Most editors don't handle trailing newlines the same way
Neovim/Vim does, it's clearly visible if it's present or not. With that
in mind it's understandable why sending end position as simply the start
of the line after the last one is considered invalid in such cases.
2023-09-21 03:06:40 -07:00
bfredl
911f3d9623 fix(tui): don't overwrite an assertion faliure message on exit
If nvim exited with nonzero status this is for one of the two reasons
- `:cquit` was invoked. This is used by users and plugins to communicate
  a result, like a nonzero status will fail a `git commit` operation
- There was an internal error or deadly signal. in this case an error
  message was likely written to stderr or to the screen.

In the latter case, the error message was often hidden by the TUI
exiting altscreen mode, which erases all visible terminal text.

This change prevents this in the latter case, while still cleaning up
the terminal properly when `:cquit` was deliberatily invoked.
Other cleanup like exiting mouse mode and raw mode is still done.
2023-09-21 10:18:37 +02:00
Jaehwang Jung
8bd6f7c20b
fix(lsp): clear codelens on LspDetach (#24903)
Also fix incorrect parameters in on_detach callback.
2023-09-21 09:56:15 +02:00
bfredl
f246cf029f
Merge pull request #25270 from bfredl/indeterminism
fix(test): fix "indeterminism" warnings in UI tests
2023-09-21 09:36:41 +02:00
zeertzjq
48410e8486
vim-patch:a7aba6ca5033 (#25285)
runtime(doc): format jumplist examples more consistently (vim/vim#13137)

a7aba6ca50
2023-09-21 15:06:06 +08:00
Christian Clason
520ef606e9 build(deps): bump luajit to HEAD - d1a2fef8a 2023-09-21 08:16:44 +02:00
zeertzjq
0aea8fad48
Merge pull request #25281 from zeertzjq/vim-9.0.1919
vim-patch:9.0.1919: Wrong curswant when clicking on empty line or with vsplits
2023-09-21 12:05:08 +08:00
zeertzjq
e25cf47ad3 fix(mouse): click on empty line with 'foldcolumn' 2023-09-21 11:13:48 +08:00
zeertzjq
acc32f20be test(ui/float_spec): click in bordered float sets correct curswant 2023-09-21 09:55:47 +08:00
zeertzjq
adb73772d9 vim-patch:9.0.1919: Wrong curswant when clicking on empty line or with vsplits
Problem:  Wrong curswant when clicking on empty line or with vsplits.
Solution: Don't check for ScreenCols[] before the start of the window
          and handle empty line properly.

closes: vim/vim#13132

03cd697d63
2023-09-21 09:43:12 +08:00
zeertzjq
f094db0e5c
vim-patch:9.0.1921: not possible to use the jumplist like a stack (#25278)
Problem:  not possible to use the jumplist like a stack
Solution: Add the 'jumpoptions' setting to make the jumplist
          a stack.

Add an option for using jumplist like tag stack

related: vim/vim#7738
closes: vim/vim#13134

ported from NeoVim:

- https://neovim.io/doc/user/motion.html#jumplist-stack
- neovim/neovim@39094b3
- https://vi.stackexchange.com/questions/18344/how-to-change-jumplist-behavior

Based on the feedback in the previous PR, it looks like many people like
this option.

87018255e3

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Co-authored-by: butwerenotthereyet <58348703+butwerenotthereyet@users.noreply.github.com>
2023-09-21 07:37:03 +08:00
zeertzjq
dc6c11394b
fix(statuscolumn): update number hl for each screen line (#25277) 2023-09-21 07:03:26 +08:00
Christian Clason
473d0aa3e6 vim-patch:9.0.1918
patch 9.0.1918: No filetype detection for Authzed filetypes

Problem:  No filetype detection for Authzed filetypes
Solution: Detect the *.zed file extension as authzed filetype

closes: vim/vim#13129

5790a54166

Co-authored-by: Matt Polzin <mpolzin@workwithopal.com>
2023-09-21 00:32:35 +02:00
bfredl
380b634ac9 fix(test): fix "indeterminism" warnings in UI tests 2023-09-20 21:51:57 +02:00
Ibby
23c21e7630
fix(extmarks): account for rightleft when drawing virt text (#25262)
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2023-09-20 22:39:54 +08:00
zeertzjq
818d7f6daf
fix(extmarks): fix win_col virt_text drawn on wrong screen line (#25264) 2023-09-20 21:48:12 +08:00
Lewis Russell
877d04d0fb feat(lua): add vim.func._memoize
Memoizes a function, using a custom function to hash the arguments.

Private for now until:

- There are other places in the codebase that could benefit from this
  (e.g. LSP), but might require other changes to accommodate.
- Invalidation of the cache needs to be controllable. Using weak tables
  is an acceptable invalidation policy, but it shouldn't be the only
  one.
- I don't think the story around `hash_fn` is completely thought out. We
  may be able to have a good default hash_fn by hashing each argument,
  so basically a better 'concat'.
2023-09-20 13:42:41 +01:00
Lewis Russell
11865dbe39 fix(build): better deps for doc 2023-09-20 13:42:41 +01:00