| Commit message (Collapse) | Author | Age |
|
|
| |
Result of `make iwyu` (after some "fixups").
|
|
|
|
|
|
|
| |
Problem: Two separate try/end wrappers, that only marginally differ by
restoring a few variables. Wrappers that don't restore
previous state are dangerous to use in "api-fast" functions.
Solution: Remove wrappers that don't restore the previous state.
Always use TRY_WRAP.
|
|
|
|
|
|
|
|
|
|
|
| |
Problem:
- API functions using `try_start` directly, do not surface the
underlying error message, and instead show generic messages.
- Error-handling code is duplicated in the API impl.
- Failure modes are not tested.
Solution:
- Use `TRY_WRAP`.
- Add tests.
|
|
|
|
|
|
|
|
|
|
|
| |
Problem:
- API functions using `try_start` directly instead of `TRY_WRAP`, do not
surface the underlying error message, and instead show generic things
like "Failed to set buffer".
- Error handling code is duplicated in the API impl, instead of
delegating to the vim buffer/window handling logic.
Solution:
- Use `TRY_WRAP`.
|
|
|
|
|
|
|
|
|
|
|
|
| |
## Problem
With 'winfixbuf' enabled, `nvim_win_set_buf` and `nvim_set_current_buf` fail
even if targeting the already-current buffer.
vim.wo.winfixbuf = true
vim.api.nvim_win_set_buf(0, 0)
vim.api.nvim_set_current_buf(0)
Solution:
Check for this condition.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In the api_info() output:
:new|put =map(filter(api_info().functions, '!has_key(v:val,''deprecated_since'')'), 'v:val')
...
{'return_type': 'ArrayOf(Integer, 2)', 'name': 'nvim_win_get_position', 'method': v:true, 'parameters': [['Window', 'window']], 'since': 1}
The `ArrayOf(Integer, 2)` return type didn't break clients when we added
it, which is evidence that clients don't use the `return_type` field,
thus renaming Dictionary => Dict in api_info() is not (in practice)
a breaking change.
|
| |
|
|
|
|
| |
Revert commit c971f538ab87b537ae4c97bd44167661c5691a2d.
Forcing grid cursor position will need a new API like originally proposed in #27858.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Problem: noautocmd is confusing; despite its name, it doesn't block all
autocommands (instead it blocks only those related to setting the buffer), and
is commonly used by plugins to open windows while producing minimal
side-effects.
Solution: be consistent and block all autocommands when noautocmd is set.
This includes WinNew (again), plus autocommands from entering the window (if
enter is set) like WinEnter, WinLeave, TabEnter, .etc.
See the discussion at https://github.com/neovim/neovim/pull/14659#issuecomment-2040029517
for more information.
Remove win_set_buf's noautocmd argument, as it's no longer needed.
NOTE: pum_create_float_preview sets noautocmd for win_set_buf, but all its
callers already use block_autocmds.
Despite that, pum_create_float_preview doesn't actually properly handle
autocommands (it has no checks for whether those from win_enter or
nvim_create_buf free the window).
For now, ensure autocommands are blocked within it for correctness (in case it's
ever called outside of a block_autocmds context; the function seems to have been
refactored in #26739 anyway).
|
|
|
|
|
|
| |
Problem: Cursor position set by nvim_win_set_cursor() is not reflected
on the screen when followed by a blocking call like getchar().
Solution: Immediately update the cursor position on the grid.
|
|
|
|
|
|
|
|
|
|
|
| |
A lot of functions in move.c only worked for curwin, alternatively
took a `wp` arg but still only work if that happens to be curwin.
Refactor those that are needed for update_topline(wp) to work
for any window.
fixes #27723
fixes #27720
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Problem: Cannot keep a buffer focused in a window
(Amit Levy)
Solution: Add the 'winfixbuf' window-local option
(Colin Kennedy)
fixes: vim/vim#6445
closes: vim/vim#13903
https://github.com/vim/vim/commit/215703563757a4464907ead6fb9edaeb7f430bea
N/A patch:
vim-patch:58f1e5c0893a
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Problem:
The documentation flow (`gen_vimdoc.py`) has several issues:
- it's not very versatile
- depends on doxygen
- doesn't work well with Lua code as it requires an awkward filter script to convert it into pseudo-C.
- The intermediate XML files and filters makes it too much like a rube goldberg machine.
Solution:
Re-implement the flow using Lua, LPEG and treesitter.
- `gen_vimdoc.py` is now replaced with `gen_vimdoc.lua` and replicates a portion of the logic.
- `lua2dox.lua` is gone!
- No more XML files.
- Doxygen is now longer used and instead we now use:
- LPEG for comment parsing (see `scripts/luacats_grammar.lua` and `scripts/cdoc_grammar.lua`).
- LPEG for C parsing (see `scripts/cdoc_parser.lua`)
- Lua patterns for Lua parsing (see `scripts/luacats_parser.lua`).
- Treesitter for Markdown parsing (see `scripts/text_utils.lua`).
- The generated `runtime/doc/*.mpack` files have been removed.
- `scripts/gen_eval_files.lua` now instead uses `scripts/cdoc_parser.lua` directly.
- Text wrapping is implemented in `scripts/text_utils.lua` and appears to produce more consistent results (the main contributer to the diff of this change).
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Note: this contains two _temporary_ changes which can be reverted
once the Arena vs no-Arena distinction in API wrappers has been removed.
Both nlua_push_Object and object_to_vim_take_luaref() has been changed
to take the object argument as a pointer. This is not going to be
necessary once these are only used with arena (or not at all) allocated
Objects.
The object_to_vim() variant which leaves luaref untouched might need to
stay for a little longer.
|
|
|
|
|
|
|
|
|
|
|
|
| |
and for return value of nlua_exec/nlua_call_ref, as this uses
the same family of functions.
NB: the handling of luaref:s is a bit of a mess.
add api_luarefs_free_XX functions as a stop-gap as refactoring
luarefs is a can of worms for another PR:s.
as a minor feature/bug-fix, nvim_buf_call and nvim_win_call now preserves
arbitrary return values.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Problem: Things that temporarily change/restore curwin/buf (e.g:
win_execute, some autocmds) may break assumptions that
curwin/buf is the cmdwin when "cmdwin_type != 0", causing
issues.
Solution: Expose the cmdwin's real win/buf and check that instead. Also
try to ensure these variables are NULL if "cmdwin_type == 0",
allowing them to be used directly in most cases without
checking cmdwin_type. (Sean Dewar)
Reset and save `cmdwin_old_curwin` in a similar fashion.
Apply suitable changes for API functions and add Lua tests.
https://github.com/vim/vim/commit/988f74311c26ea9917e84fbae608de226dba7e5f
|
|
|
|
|
|
| |
Remove `export` pramgas from defs headers as it causes IWYU to believe
that the definitions from the defs headers comes from main header, which
is not what we really want.
|
| |
|
|
|
|
|
|
| |
FUNC_ATTR_* should only be used in .c files with generated headers.
Defining FUNC_ATTR_* as empty in headers causes misuses of them to be
silently ignored. Instead don't define them by default, and only define
them as empty after a .c file has included its generated header.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
We already have an extensive suite of static analysis tools we use,
which causes a fair bit of redundancy as we get duplicate warnings. PVS
is also prone to give false warnings which creates a lot of work to
identify and disable.
|
| |
|
|
|
|
| |
A command typed in the cmdwin and executed with `<CR>` is expected to be
executed in the context of the old curwin/buf, so it shouldn't be changed.
|
|
|
|
|
| |
Initially this is just for geting rid of boilerplate,
but eventually the types could get exposed as metadata
|
|
|
|
|
|
|
| |
This aligns its behaviour better with `nvim_win_close`.
Note that `:hide` is actually incapable of closing the cmdwin, unlike `:close`
and `:quit`, so this is a bit of a difference in behaviour.
|
|
|
|
|
|
|
|
|
|
|
| |
Disallow closing the previous window from `nvim_win_close`, as this will cause
issues.
Again, no telling how safe this is. It also requires exposing old_curwin. :/
Also note that it's possible for the `&cmdheight` to change if, for example,
there are 2 tabpages and `nvim_win_close` is used to close the last window in
the other tabpage while `&stal` is 1. This is addressed in a later commit.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Problem: As discussed on Matrix, there was some interest in having
`nvim_open_win` again be able to open floats in the cmdwin (e.g: displaying a
hover doc related to what's in the cmdwin). After #23228, this was disallowed.
Solution: Allow `nvim_open_win` in the cmdwin as long as `!enter` and
`buffer != curbuf` (the former can cause all sorts of issues, and the latter
can crash Nvim after closing cmdwin). Also allow `nvim_win_set_buf` in a similar
fashion.
Note that we're not *entirely* sure if this is 100% safe (cmdwin is a
global-state-using-main-loop-calling beast), but this seems to work OK..?
Also:
- Check the buffer argument of `nvim_open_win` earlier, and abort if it's
invalid (it used to still open a window in this case).
- Untranslate `e_cmdwin` errors in the API (other errors in the API are not
translated: although not detailed in the API contract yet, errors are
supposed to be stable).
|
| |
|
|
|
|
| |
It uses the same code as "scroll_delta" of "win_viewport" UI event to
calculate text height, but is more flexible.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
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).
|
|
|
|
|
|
|
|
|
| |
Co-authored by: zeertzjq <zeertzjq@outlook.com>
Co-authored by: Steven Todd McIntyre II <114119064+stmii@users.noreply.github.com>
Co-authored by: nobe4 <nobe4@users.noreply.github.com>
- docs: mention --luadev-mod to run with lua runtime files
When changing a lua file in the ./runtime folder, a new contributor
might expect changes to be applied to the built Neovim binary.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
(#21921)" (#21979)
This reverts commit 0371d0f7afa5e01dd2ac8bbd3abcf0f7454872b3.
> 'bufhidden' option exists. I don't think we should assume autoclosing
windows are fine just because 'hidden' is set.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Problem:
The "force" flag of win_close() complicates the code and adds edge cases
where it is not clear what the correct behavior should be.
The "free_buf" flag of win_close() is passed on to float windows when
closing the last window of a tabpage, which doesn't make much sense.
Solution:
Remove the "force" flag and always close float windows as if :close! is
used when closing the last window of a tabpage, and set the "free_buf"
flag for a float window based on whether its buffer can be freed.
As 'hidden' is on by default, this change shouldn't affect many people.
|
|
|
| |
This is the same code change as https://github.com/vim/vim/commit/6c87bbb4e45515e70ac1728cabd1451063bf427d
|
|
|
|
|
|
|
| |
Problem: Some source files are too big.
Solution: Move buffer and window related functions to evalbuffer.c and
evalwindow.c. (Yegappan Lakshmanan, closes vim/vim#4898)
https://github.com/vim/vim/commit/261f346f8154c0ec7094a4a211c653c74e9f7c2e
|
|
|
|
|
|
| |
(#21072)
fix #19063
this fixes the cursorcolumn not being redrawn for non-current windows in `nvim_win_set_cursor()`
|
|
|
|
|
|
|
|
|
|
| |
Allow Include What You Use to remove unnecessary includes and only
include what is necessary. This helps with reducing compilation times
and makes it easier to visualise which dependencies are actually
required.
Work on https://github.com/neovim/neovim/issues/549, but doesn't close
it since this only works fully for .c files and not headers.
|
|
|
|
|
|
|
|
|
|
|
|
| |
- increase python line-length limit from 88 => 100.
- gen_help_html: fix bug in "tag" case (tbl_count => tbl_contains)
ref #15632
fix #18215
fix #18479
fix #20527
fix #20532
Co-authored-by: Ben Weedon <ben@weedon.email>
|
|
|
|
|
| |
Co-authored-by: Raphael <glephunter@gmail.com>
Co-authored-by: smjonas <jonas.strittmatter@gmx.de>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
|