Commit Graph

26526 Commits

Author SHA1 Message Date
Gregory Anders
3750e5ed9c
vim-patch:9.0.1673: cannot produce a status 418 or 503 message (#24287)
Problem:    Cannot produce a status 418 or 503 message.
Solution:   Add err_teapot().

80adaa8ae8

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-07-10 11:55:12 -05:00
Raphael
766f4978d6
fix(lint): lint warnings #24226 2023-07-10 04:38:15 -07:00
zeertzjq
fbeef0d4ef
fix(completion): don't add backslashes to runtime pattern (#24296)
Problem:    Bashslashes added as regexp in runtime completion may be
            treated as path separator with some 'isfname' value.
Solution:   Make curly braces work for runtime completion and use it.
2023-07-08 23:29:24 +08:00
Justin M. Keyes
b9a0e762f1 fix(defaults): visual star (*) on text with "?"
regression from 6318edadc3
2023-07-08 16:55:27 +02:00
Justin M. Keyes
0a90e4b05a fix(docs): match DocSearch style with site theme
ref 2b4f9e4780
2023-07-08 16:06:46 +02:00
Justin M. Keyes
6318edadc3 fix(defaults): visual hash (#) on text with "?"
Problem:
The default "#" mapping fails on the following example after v$h# with
cursor at start of the first line:

    aa?/\bb
    aa
    aa?/\bb

Solution:
Also escape "?".
2023-07-08 15:33:28 +02:00
Justin M. Keyes
7c077a3c2b
Merge #24295 from justinmk/doc2
docs: "Return (multiple)", condense @notes
2023-07-08 06:29:48 -07:00
Justin M. Keyes
d2e44da516 docs: gather @notes items into one section
related: 21eacbfef3
2023-07-08 15:06:36 +02:00
Justin M. Keyes
3a721820c3 docs: "Return (multiple)" heading
Problem:
Lua functions that return multiple results are declared by using
multiple `@return` docstring directives. But the generated docs don't
make it obvious what this represents.

Solution:
- Generate a "Return (multiple)" heading for multiple-value functions.
- Fix `@note` directives randomly placed after `@return`.
2023-07-08 15:06:36 +02:00
Justin M. Keyes
00d2f4b96e docs: MAINTAIN.md, nvim_get_mark 2023-07-08 15:06:36 +02:00
zeertzjq
8c9e37cc09
test(tui): add test for overriding argv[0] (#24293) 2023-07-08 18:27:53 +08:00
Chinmay Dalal
21fa19f3e8
fix(lsp): don't use hl_mode = combine for inlay hints #24276
Problem: `hl_mode` for inlay hints is `combine`, causing bugs like
inlay hints using highlights from the previous character
(#24152, #24068)

Solution: Don't use hl_mode=combine for inlay hints.
2023-07-08 00:14:52 -07:00
Ibby
c4df2f08b6
fix(extmarks): fix wrong highlight after "combine" virt_text (#24281) 2023-07-08 09:53:30 +08:00
zeertzjq
559c4cfd52
fix(startup): run embedded Nvim with real path (#24282)
fix(startup): run embedded process with real path
2023-07-08 08:27:39 +08:00
Lewis Russell
c379d72c49
feat(lua): allow vim.wo to be double indexed (#20288)
* feat(lua): allow vim.wo to be double indexed

Problem: `vim.wo` does not implement `setlocal`
Solution: Allow `vim.wo` to be double indexed

Co-authored-by: Christian Clason <c.clason@uni-graz.at>
2023-07-07 16:37:36 +01:00
Lewis Russell
804108af6c
docs: CONTRIBUTING.md updates (#24280) 2023-07-07 13:52:30 +01:00
Jaehwang Jung
c44d819ae1
fix(treesitter): update folds in all relevant windows (#24230)
Problem: When using treesitter foldexpr,
* :diffput/get open diff folds, and
* folds are not updated in other windows that contain the updated
  buffer.

Solution: Update folds in all windows that contain the updated buffer
and use expr foldmethod.
2023-07-07 11:12:46 +01:00
zeertzjq
811140e276
fix(folds): fix missing virt_lines above when fold is hidden (#24274) 2023-07-07 09:49:58 +08:00
zeertzjq
36941942d6
fix(drawline): inline virt_text hl_mode inside syntax/extmark hl (#24273) 2023-07-07 07:21:12 +08:00
Justin M. Keyes
06c4edf46b
Merge #21677 fix(defaults): visual star (*,#) is fragile 2023-07-06 04:05:13 -07:00
Justin M. Keyes
f39ca5df23 refactor(defaults): use vim.region for visual star (*,#)
Problem:
The parent commit added a new vim.get_visual_selection() function to
improve visual star. But that is redundant with vim.region(). Any
current limitations of vim.region() should be fixed instead of adding
a new function.

Solution:
Delete vim.get_visual_selection().
Use vim.region() to get the visual selection.
TODO: fails with visual "block" selections.
2023-07-06 12:18:55 +02:00
Steven Ward
abd380e28d fix(defaults): visual mode star (*,#) is fragile
Problem:
Visual mode "*", "#" mappings don't work on text with "/", "\", "?", and
newlines.

Solution:
Get the visual selection and escape it as a search pattern.
Add functions vim.get_visual_selection and _search_for_visual_selection.

Fix #21676
2023-07-06 10:29:50 +02:00
zeertzjq
4e34ca8ae7
docs(luaref): remove parentheses from tags for typedefs (#24271)
And fix alignment.
2023-07-06 14:57:46 +08:00
zeertzjq
2afb04758c
fix(vim.system): close check handle (#24270)
Fix hang after running vim.system() with sanitizers.
2023-07-06 12:56:19 +08:00
zeertzjq
25e62697c3
fix(column): fix wrong cursor with 'statuscolumn' and cpo+=n (#24268) 2023-07-06 11:07:23 +08:00
zeertzjq
a0c9c04f00
refactor(plines.c): update outdated comments (#24264) 2023-07-06 04:36:22 +08:00
fredizzimo
1de82e16c1
fix(ui): delay win_viewport until screen update #24182
Problem:
Sometimes, when nvim sends the `win_viewport` event, for example when scrolling
with visible folds on the screen, it reports the `scroll_delta` value one batch
into "future". So when the client application is trying to show the new viewport
it's not yet updated, resulting in temporary corruption / screen flickering.

For more details see #23609, and starting from [this comment](
https://github.com/neovide/neovide/pull/1790#issuecomment-1518697747) in
https://github.com/neovide/neovide/pull/1790,, where the issue was first
detected. Note that some of the conclusions in those are not fully accurate, but
the general observations are.

Solution:
When there are pending updates to a Window, delay the `win_viewport` UI event
until the updates are sent. This ensures that there's no flush between sending
the viewport and updating of the lines corresponding to the new viewport.

Document the existing viewport behaviour (for cases where there are no
extra flushes), give a hint about how applications can deal with the slightly
surprising behaviour of the viewport event being sent after the updates.

Fixes https://github.com/neovim/neovim/issues/23609
2023-07-05 06:31:34 -07:00
zeertzjq
8a788e2daa
Merge pull request #23228 from seandewar/cmdwin-jail
fix(api): use `text_locked()` to check for textlock
2023-07-05 17:04:17 +08:00
zeertzjq
df297e3c2b
fix(runtime): don't set gx mapping if already mapped (#24262)
This matches netrw's use of maparg().
2023-07-05 16:31:45 +08:00
zeertzjq
317038e7cb
fix(plines): don't return very large height on very long line (#24260) 2023-07-05 16:30:23 +08:00
Sean Dewar
aa4e47f704
fix(api): disallow some more functions during textlock
Problem: nvim_buf_set_text(), nvim_open_term() and termopen() all change buffer
text, which is forbidden during textlock. Additionally, nvim_open_term() and
termopen() may be used to convert the cmdwin buffer into a terminal buffer,
which is weird.

Solution: Allow nvim_buf_set_text() and nvim_open_term() in the cmdwin, but
disallow nvim_open_term() from converting the cmdwin buffer into a terminal
buffer. termopen() is not allowed in the cmdwin (as it always operates on
curbuf), so just check text_locked().

Also happens to improve the error in #21055: nvim_buf_set_text() was callable
during textlock, but happened to check textlock indirectly via u_save();
however, this caused the error to be overwritten by an unhelpful "Failed to
save undo information" message when msg_list == NULL (e.g: an `<expr>` mapping
invoked outside of do_cmdline()).
2023-07-05 08:33:32 +01:00
Sean Dewar
77118d0da8
fix(api): use text_locked() to check textlock
Problem: some API functions that check textlock (usually those that can change
curwin or curbuf) can break the cmdwin.

Solution: make FUNC_API_CHECK_TEXTLOCK call text_locked() instead, which already
checks for textlock, cmdwin and `<expr>` status.

Add FUNC_API_TEXTLOCK_ALLOW_CMDWIN to allow such functions to be usable in the
cmdwin if they can work properly there; the opt-in nature of this attribute
should hopefully help mitigate future bugs.

Also fix a regression in #22634 that made functions checking textlock usable in
`<expr>` mappings, and rename FUNC_API_CHECK_TEXTLOCK to FUNC_API_TEXTLOCK.
2023-07-05 08:31:52 +01:00
Justin M. Keyes
5936a88f18
Merge #23401 vim.ui.open: "gx" without netrw 2023-07-05 00:30:05 -07:00
zeertzjq
b2e8c0df20
fix(edit): fix K_EVENT interfering with 'digraph' (#24258) 2023-07-05 12:06:14 +08:00
Justin M. Keyes
e644e7ce0b fix(vim.ui.open): return (don't show) error message
Problem:
Showing an error via vim.notify() makes it awkward for callers such as
lsp/handlers.lua to avoid showing redundant errors.

Solution:
Return the message instead of showing it. Let the caller decide whether
and when to show the message.
2023-07-05 00:49:10 +02:00
Justin M. Keyes
67b2ed1004 fix(gx): visual selection, expand env vars
---
Rejected experiment: move vim.ui.open() to vim.env.open()

Problem:
`vim.ui` is where user-interface "providers" live, which can be
overridden. It would also be useful to have a "providers" namespace for
platform-specific features such as "open", clipboard, python, and the other
providers listed in `:help providers`. We could overload `vim.ui` to
serve that purpose as the single "providers" namespace, but
`vim.ui.nodejs()` for example seems awkward.

Solution:
`vim.env` currently has too narrow of a purpose. Overload it to also be
a namespace for `vim.env.open`.

diff --git a/runtime/lua/vim/_meta.lua b/runtime/lua/vim/_meta.lua
index 913f1fe20348..17d05ff37595 100644
--- a/runtime/lua/vim/_meta.lua
+++ b/runtime/lua/vim/_meta.lua
@@ -37,8 +37,28 @@ local options_info = setmetatable({}, {
   end,
 })

-vim.env = setmetatable({}, {
-  __index = function(_, k)
+vim.env = setmetatable({
+  open = setmetatable({}, {
+      __call = function(_, uri)
+        print('xxxxx'..uri)
+        return true
+      end,
+      __tostring = function()
+        local v = vim.fn.getenv('open')
+        if v == vim.NIL then
+          return nil
+        end
+        return v
+      end,
+    })
+  },
+  {
+  __index = function(t, k, ...)
+    if k == 'open' then
+      error()
+      -- vim.print({...})
+      -- return rawget(t, k)
+    end
     local v = vim.fn.getenv(k)
     if v == vim.NIL then
       return nil
2023-07-04 23:45:35 +02:00
marshmallow
af6e6ccf3d feat(vim.ui): vim.ui.open, "gx" without netrw
Co-authored-by: Mathias Fußenegger <mfussenegger@users.noreply.github.com>
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
Co-authored-by: ii14 <59243201+ii14@users.noreply.github.com>
2023-07-04 23:45:00 +02:00
notomo
3ecd45ded0
fix(api): allow negative column arguments for nvim_buf_set_text (#23501) 2023-07-04 22:07:55 +08:00
Raphael
cf5f1492d7
fix(lsp): revert change to buf.clear_references() #24238
Problem: in #24046 the signature of buf.clear_references() changed, which
indirectly breaks callers that were passing "ignored" args.

Solution: because util.buf_clear_references() already defaulted to "current buffer",
the change to buf.clear_references() isn't actually needed, so just revert it.
2023-07-04 05:30:31 -07:00
Emir SARI
cebc00603e
feat(l10n): update Turkish translations #24246 2023-07-04 05:20:19 -07:00
zeertzjq
a76b689b47
perf(ui-ext): approximate scroll_delta when scrolling too much (#24234) 2023-07-04 16:48:53 +08:00
zeertzjq
e8b3ed74bc
fix(ui-ext): "scroll_delta" handle topfill and skipcol (#24249) 2023-07-04 14:14:09 +08:00
zeertzjq
92760a7f42
fix(api, lua): make blank lines in a message work properly (#24244) 2023-07-04 07:19:02 +08:00
zeertzjq
35c3275b48
fix(plines): handle inline virtual text after last char (#24241)
Also remove dead code in win_lbr_chartabsize().
2023-07-03 22:57:45 +08:00
Justin M. Keyes
6da110d617
docs(gen_help_html): accept "~/" in file/dir params #24240 2023-07-03 05:04:43 -07:00
bfredl
5f442e1a4a
Merge pull request #23167 from dundargoc/refactor/long
refactor: remove long
2023-07-03 13:17:37 +02:00
dundargoc
fcf3519c65 refactor: remove long
long is 32-bits even on 64-bit windows which makes the type suboptimal
for a codebase meant to be cross-platform.
2023-07-03 12:49:09 +02:00
bfredl
f771d62471
Merge pull request #23891 from rickyz/grid_line_flags
fix(ui): propagate line flags on grid_line events
2023-07-03 09:53:27 +02:00
Jaehwang Jung
4fd852b8cb
perf(treesitter): cache fold query (#24222)
perf(treesitter): cache vim.treesitter.query.get

Problem:
vim.treesitter.query.get searches and reads query files every time it's
called, if user hasn't overridden the query. So this can incur slowdown
when called frequently.

This can happen when using treesitter foldexpr. For example, when using
`:h :range!` in markdown file to format fenced codeblock, on_changedtree
in _fold.lua is triggered many times despite that the tree doesn't have
syntactic changes (might be a bug in LanguageTree). (Incidentally, the
resulting fold is incorrect due to a bug in `:h range!`.) on_changedtree
calls vim.treesitter.query.get for each tree changes. In addition, it
may request folds queries for injected languages without fold queries,
such as markdown_inline.

Solution:
* Cache the result of vim.treesitter.query.get.
* If query file was not found, fail quickly at later calls.
2023-07-02 16:44:21 +01:00
Christian Clason
2d40f5e843
build(deps): bump luv to 1.45.0-0 (#24228)
https://github.com/luvit/luv/releases/tag/1.45.0-0
2023-07-02 11:17:23 +02:00