Commit Graph

21772 Commits

Author SHA1 Message Date
bfredl
c847a0eeb7
Merge pull request #18664 from famiu/fix/winbar_crash
fix: prevent crash when statusline expression sets value of 'winbar'
2022-05-20 19:29:34 +02:00
Christian Clason
cda0ef23cf
build(deps): bump LuaJIT to HEAD - 4ef96cff8 (#18656) 2022-05-20 19:19:37 +02:00
Famiu Haque
e884e460bc fix: prevent crash when statusline expression sets value of 'winbar'
Closes #18649
2022-05-20 23:03:06 +06:00
bfredl
ffb55261a8
Merge pull request #18653 from dundargoc/refactor/move-reverse-text
refactor: move reverse_text to strings.c as it's a string operation
2022-05-20 17:00:51 +02:00
zeertzjq
76691bea04
Merge pull request #18657 from dundargoc/vim-8.2.4985
vim-patch:8.2.4985: PVS warns for possible array underrun
2022-05-20 22:23:20 +08:00
Dundar Goc
1a0de90068 refactor: move reverse_text to strings.c as it's a string operation
Also add tests for reverse_text.

Co-authored-by: Kalle Ranki <kalle.ranki@gmail.com>
2022-05-20 16:11:54 +02:00
Dundar Goc
02fd4ec83f vim-patch:8.2.4985: PVS warns for possible array underrun
Problem:    PVS warns for possible array underrun.
Solution:   Add a check for a positive value. (closes vim/vim#10451)
875339b22a
2022-05-20 15:15:13 +02:00
bfredl
1d160a76ec
Merge pull request #18641 from famiu/fix/nvim_cmd/keymap_error_suppress
fix: make `nvim_cmd` not suppress errors inside key mapping
2022-05-20 14:22:44 +02:00
James McCoy
3e627f9e55
ci(coverity): run every day instead of once/week
Neovim currently falls in the 100 kLOC - 500 kLOC bucket, which can scan
3x/day.
2022-05-20 08:17:47 -04:00
James McCoy
83f42e086a
perf(cid/350479): avoid copying ExtmarkInfo when calling extmark_to_array() 2022-05-20 08:17:39 -04:00
James McCoy
501ee06d3a
fix(cid/352782): assert str->items is non-NULL to hint static analyzers
The earlier vsnprintf() call checks whether str->items is NULL, sets of
the "possible NULL" spidey sense.  kv_ensure_space() guarantees
str->items is non-NULL but since it doesn't use NULL checks to decide
whether to alloc, static analyzers can't tell this code path is safe.
2022-05-20 08:17:33 -04:00
James McCoy
d31e68d5d0
fix(cid/348314): free user_copy, not user
user is passed in by the caller, which we internally copy.  We should be
freeing our copy, not the caller's string.
2022-05-20 08:15:13 -04:00
James McCoy
f15122e8a2
fix(cid/351940): free compl_arg in create_user_commands()'s error path exit 2022-05-20 08:15:07 -04:00
James McCoy
6954c0ba0d
ci(coverity): annotate register_cfunc as leaking memory
register_cfunc allocates a ufunc_T, but doesn't store the pointer
anywhere before returning.  The uf_name member variable is stored in a
hashtable and used to lookup the ufunc_T later, but that's too much for
Coverity to track.

Adding the annotation ensures that any new callers to register_cfunc
don't pop up as new "leaks" in the Coverity scans.
2022-05-20 08:14:37 -04:00
James McCoy
1da7e2b8ca
ci(coverity): model our allocation functions
Coverity was reporting false positives, particularly around for non-NUL
terminated strings around uses of xmemdupz().  The updated model
ensures Coverity understands xmemdupz allocates an extra byte and sets it
to NUL as well as the main details of our other allocation related
wrappers.
2022-05-20 08:14:20 -04:00
Fredrik Ekre
a4862cbb5f
fix(lsp): only send diagnostics from current buffer in code_action() (#18639)
Fix vim.lsp.buf.(range_)code_action() to only send diagnostics belonging
to the current buffer and not to other files in the workspace.
2022-05-20 13:11:23 +02:00
zeertzjq
eb0aa8bb0e
vim-patch:8.2.4980: when 'shortmess' contains 'A' loading session may still warn (#18636)
Problem:    When 'shortmess' contains 'A' loading a session may still warn for
            an existing swap file. (Melker Österberg)
Solution:   Keep the 'A' flag to 'shortmess' in the session file.
            (closes vim/vim#10443)
aaadb5b6f7

Use readfile() with "B" flag in test as readblob() needs patch 8.2.2343.
2022-05-20 07:20:38 +08:00
bfredl
69853a622a
Merge pull request #18629 from famiu/fix/ui/winbar
fix(ui): make `winbar` properly equalize window heights for local value
2022-05-19 21:58:48 +02:00
zeertzjq
bb8d05f932
Merge pull request #18638 from zeertzjq/fix-winbar-mouse
Fix mouse drag position with winbar
2022-05-20 03:34:34 +08:00
Famiu Haque
fb8fa004d8 fix: make nvim_cmd not suppress errors inside key mapping
Closes #18632
2022-05-19 22:23:14 +06:00
Famiu Haque
643cc94e7e fix(ui): make winbar properly equalize window heights for local value
Fixes `'winbar'` not properly equalizing window heights for splits when
the global value is empty and a window-local value is set instead.
2022-05-19 19:14:54 +06:00
zeertzjq
f971536f46 fix(mouse): fix mouse drag position with winbar or border in multigrid 2022-05-19 19:16:49 +08:00
zeertzjq
0997884ae2 fix(mouse): fix mouse drag position with winbar 2022-05-19 19:16:31 +08:00
Christian Clason
d200ba654a
Merge pull request #18502 from drybalka/fix-languagetree-contains-description
treesitter: small improvements of languagetree.lua
2022-05-19 09:17:10 +02:00
zeertzjq
95580f31b3
test(mksession_spec): only sleep on Windows (#18637) 2022-05-19 10:42:05 +08:00
zeertzjq
341d0ec3b3
vim-patch:8.2.4979: accessing freed memory when line is flushed (#18634)
Problem:    Accessing freed memory when line is flushed.
Solution:   Make a copy of the pattern to search for.
28d032cc68
2022-05-19 09:56:44 +08:00
Gregory Anders
6a2883c171
Merge pull request #18630 from dundargoc/refactor/remove-remap 2022-05-18 17:37:15 -06:00
zeertzjq
18fbdaeeab
fix(termopen): avoid ambiguity in URI when CWD is root dir (#16988) 2022-05-19 06:47:33 +08:00
Dundar Goc
97fc68850f refactor!: remove 'terse' option
Having two methods of setting the same option is redundant and can be
potentially confusing. Recommend adding 's' to 'shortmess' instead.
2022-05-19 00:15:40 +02:00
Dundar Goc
11957f51cc refactor!: remove 'remap' option
An option that should always be kept on except for when working with old
Vi scripts is of little use to us.
2022-05-19 00:15:36 +02:00
ckipp01
86db222469 docs(extmark): remove message about passing in id=0
The docs for `nvim_buf_set_extmark` mention that you can create a new
extmark when passing in `id=0`, however if you do this you'll get an
error since the code checks that id is positive.

```
id is not a positive integer
```

This change re-words the sentence to make it clearer.
2022-05-18 21:49:31 +02:00
bfredl
6f0baa0bb7
Merge pull request #18620 from bfredl/multibar
fix(ui): make winbar work with floats and multigrid
2022-05-18 21:18:34 +02:00
Lewis Russell
3eea66d65a
feat(lsp): option to reuse_win for jump actions (#18577) 2022-05-18 21:03:24 +02:00
bfredl
503d8b0892 refactor(events): remove unnecessary fudging of updating_screen
This was not necessary after the introduction of `resize_events`,
after which ui resizes are not `fast_events` anymore.
2022-05-18 20:16:19 +02:00
bfredl
17758fe7ad fix(ui): make winbar work with floats and multigrid 2022-05-18 20:16:18 +02:00
bfredl
c28192e6f9 refactor: move more grid functions to grid.c. Clean up some variables 2022-05-18 20:16:18 +02:00
Gregory Anders
03a8269e3a
Merge pull request #18507 from gpanders/au-lsp-attached 2022-05-18 11:59:03 -06:00
bfredl
b840b5b6a9
Merge pull request #18624 from famiu/feat/ui/winbar
fix(ui): set correct position on mouse click when 'winbar' is enabled
2022-05-18 19:55:01 +02:00
Denys
fec944142b
refactor: simple logic in tree_contains() 2022-05-18 19:28:49 +02:00
Denys
f66a60805d
docs: correct description of LanguageTree:contains() 2022-05-18 19:28:41 +02:00
Gregory Anders
ed93186ee2 feat(lsp): add filter to vim.lsp.get_active_clients()
Allow get_active_clients() to filter on client name, id, or buffer. This
(soft) deprecates lsp.buf_get_clients().
2022-05-18 11:21:00 -06:00
Gregory Anders
2ffafc7aa9 feat(lsp): add LspAttach and LspDetach autocommands
The current approach of using `on_attach` callbacks for configuring
buffers for LSP is suboptimal:

1. It does not use the standard Nvim interface for driving and hooking
   into events (i.e. autocommands)
2. There is no way for "third parties" (e.g. plugins) to hook into the
   event. This means that *all* buffer configuration must go into the
   user-supplied on_attach callback. This also makes it impossible for
   these configurations to be modular, since it all must happen in the
   same place.
3. There is currently no way to do something when a client detaches from
   a buffer (there is no `on_detach` callback).

The solution is to use the traditional method of event handling in Nvim:
autocommands. When a LSP client is attached to a buffer, fire a
`LspAttach`. Likewise, when a client detaches from a buffer fire a
`LspDetach` event.

This enables plugins to easily add LSP-specific configuration to buffers
as well as enabling users to make their own configurations more modular
(e.g. by creating multiple LspAttach autocommands that each do
something unique).
2022-05-18 11:21:00 -06:00
Gregory Anders
8a9ab88945
feat(api): enable nvim_exec_autocmds to pass arbitrary data (#18613)
Add a "data" key to nvim_exec_autocmds that passes arbitrary data (API
objects) to autocommand callbacks.
2022-05-18 09:51:26 -06:00
Famiu Haque
288819c9cc fix(ui): set correct position on mouse click when 'winbar' is enabled 2022-05-18 21:15:34 +06:00
bfredl
d7dd600716
Merge pull request #18562 from famiu/feat/ui/winbar
feat(ui): add `'winbar'`
2022-05-18 13:08:07 +02:00
bfredl
028329850e refactor: grid->rows and grid->cols 2022-05-18 13:06:02 +02:00
Christian Clason
2d27732029
build(deps): bump libuv to HEAD - 730e07e2f (#18606) 2022-05-18 11:22:46 +02:00
zeertzjq
93d24a63b2
test: fix mksession terminal CWD test again (#18615) 2022-05-18 16:07:16 +08:00
zeertzjq
6e414b698c
test: unskip tests on Windows (#18600)
Remove the command('qall!') from mksession_spec.lua because it prevents
helpers.rmdir() from retrying.

Allow extra trailing spaces when matching terminal lines.
2022-05-18 12:57:04 +08:00
Famiu Haque
e1bdb2a258 feat(ui): add 'winbar'
Adds support for a bar at the top of each window, enabled through the
`'winbar'` option.

Co-authored-by: Björn Linse <bjorn.linse@gmail.com>
2022-05-18 09:27:08 +06:00