Commit Graph

21606 Commits

Author SHA1 Message Date
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
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
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
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
Justin M. Keyes
b70856009d
Merge #18605 PVS fixes 2022-05-18 02:32:15 +02:00
zeertzjq
7ded303d68
vim-patch:8.2.4975: recursive command line loop may cause a crash (#18614)
Problem:    Recursive command line loop may cause a crash.
Solution:   Limit recursion of getcmdline().
51f0bfb88a

Cherry-pick e_command_too_recursive from patch 8.2.3957.
2022-05-18 08:21:24 +08:00
Dundar Goc
10868dbf89 fix(PVS/V1044): suppress warning 2022-05-17 22:26:25 +02:00
Dundar Goc
5084b6fb92 fix(PVS/V568): correct placement of ignore directive 2022-05-17 22:26:25 +02:00
Dundar Goc
65f585ce9b fix(PVS/V547): "expression is always false"
Suppress warning in loop.c, the expression can be true if EXITFREE isn't
defined.
2022-05-17 22:26:25 +02:00
Dundar Goc
e75ccc3b3a fix(PVS/V1028): prevent potential overflow 2022-05-17 22:26:25 +02:00
Noval Maulana
38cbca3eea
fix(health): handle non-existent log file #18610
Problem:
    vim.lsp: require("vim.lsp.health").check()
    ========================================================================
      - ERROR: Failed to run healthcheck for "vim.lsp" plugin. Exception:
        function health#check, line 20
        Vim(eval):E5108: Error executing lua ...m/HEAD-6613f58/share/nvim/runtime/lua/vim/lsp/health.lua:20: attempt to index a nil value
        stack traceback:
        ...m/HEAD-6613f58/share/nvim/runtime/lua/vim/lsp/health.lua:20: in function 'check'
        [string "luaeval()"]:1: in main chunk

Solution:
Check for nil.

fix #18602
2022-05-17 11:11:14 -07:00
Jonas Strittmatter
7ffa9073a3
refactor(runtime): convert more dist#ft functions to lua (#18430) 2022-05-17 19:48:45 +02:00
bfredl
8a39032fdd
Merge pull request #18554 from kevinhwang91/perf-timerstart
perf(_editor): no need to stop inside vim.defer_fn
2022-05-17 18:59:48 +02:00
zeertzjq
f49699737c
fix(terminal): do not trim whitespace that is actually in the terminal (#16423) 2022-05-17 21:09:28 +08:00
zeertzjq
bbfc4567df
fix(health): correct shada file path #18603 2022-05-17 05:43:35 -07:00
dundargoc
b239db3cb5
feat(lintcommit): remove "chore", add "dist" #18594
"chore" is never necessary, choose "fix" or "feat" if nothing else applies.
2022-05-17 05:42:48 -07:00