summaryrefslogtreecommitdiffstatshomepage
path: root/src/nvim/winfloat.c
AgeCommit message (Collapse)AuthorFiles
2026-04-19feat(options): add 'winpinned' to pin a window #39157luukvbaal1
Problem: - Unable to "pin" a window to prevent closing without specifically being targeted. - :fclose closes hidden windows (even before visible windows). Solution: - Add 'winpinned' window-local option. When set, window is skipped by :fclose and :only. Pin the ui2 cmdline window (which should always be visible), so that it is not closed by :only/fclose. - Skip over hidden (and pinned) windows with :fclose. Co-authored-by: glepnir <glephunter@gmail.com>
2026-03-14feat(api): nvim_win_set_config can move split to other tp as floatwinSean Dewar1
Problem: not possible for nvim_win_set_config to convert a split to a floatwin, then move it to another tabpage in one call. Solution: allow it.
2026-03-14fix(winfloat): last_status when changing split to floatwinSean Dewar1
Problem: converting a split to a floatwin may not remove the last statusline when needed. (e.g: 'ls' is 1) Solution: call last_status/win_comp_pos in win_new_float, after win_remove. Also fix float_pos formatting for screen snapshots so it doesn't give a nil error for external windows. Not an issue from this PR.
2026-03-14refactor(window): lastwin_nofloating takes tpSean Dewar1
2026-03-13fix(ui): preview float doesn't respond to mouse scroll #38270glepnir1
Problem: The floating preview window (e.g. completion info) has mouse=false, so scroll wheel events pass right through it. Solution: Set mouse=true on the preview float so users can scroll its content with the mouse wheel.
2026-02-16fix(float): clamp floating window above cmdline #37899luukvbaal1
Problem: A float whose zindex is below the cmdline can be enlarged and end up behind the cmdline. Solution: Clamp height of such windows to not extend beyond 'cmdheight'.
2026-01-10fix(completion): set 'wrap' and scrolloff=0 in preview window (#37327)glepnir1
Problem: info/preview floating windows are created without wrap enabled, causing info text to be truncated. Solution: enable 'wrap' and set 'scrolloff' to 0 by default, like vim's popup_create does.
2025-11-28fix(float): null pointer dereference, redundant call #36727glepnir1
Problem: Null pointer dereference when checking *wp->w_p_stl. win_set_inner_size called twice in win_new_float. Solution: Add null check for wp->w_p_stl. Remove redundant win_set_inner_size call as win_config_float already calls it.
2025-11-27fix(float): respect statusline=3, don't inherit local 'statusline' #36716glepnir1
Problem: When creating floating window from existing window, the window-local 'statusline' option is inherited, causing unwanted statusline display. Additionally, with laststatus=3 (global statusline), the early return skipped clearing wp->w_redr_status flag. Solution: Clear inherited window-local 'statusline' in win_new_float for style="minimal". Restructure win_redr_status to always clear the flag before any early returns, and only render floating window statusline when window-local 'statusline' is explicitly set. And respect 'laststatus' option.
2025-11-26feat(float): 'statusline' in floating windows #36521glepnir1
Problem: Can't show 'statusline' in floating windows. Solution: Use window-local 'statusline' to control floating window statusline visibility.
2025-10-11fix(float): crash from nasty :fclose autocmds (#36134)Sean Dewar1
Problem: :fclose may crash Nvim if autocommands close floats prematurely. Alternatively, :fclose may call win_close for windows not in curtab if autocommands change curtab or move windows between tab pages via nvim_win_set_config (may not crash, but is wrong). Solution: check win_valid before calling win_close.
2025-09-13feat(ui): support grid=0 in nvim_input_mouse #32535fredizzimo1
Problem: Multigrid UIs have to find out which window to send the input by using the Nvim focus rules, which are not fully documented. Furthermore,`getmousepos()` has several problems when multigrid is enabled, with the main one being that screenrow and screencol are window relative instead of screen relative, due to the fact that the UI don't send any absolute coordinates. Solution: Allow passing 0 as grid to `nvim_input_mouse`, with absolute coordinates, which lets nvim determine the actual window to send the mouse input to. This works as long as nvim is in charge of the window positioning. If the UI repositions or resizes the windows, it can still pass the grid it determines like before.
2025-08-14refactor(build): remove INCLUDE_GENERATED_DECLARATIONS guardsbfredl1
These are not needed after #35129 but making uncrustify still play nice with them was a bit tricky. Unfortunately `uncrustify --update-config-with-doc` breaks strings with backslashes. This issue has been reported upstream, and in the meanwhile auto-update on every single run has been disabled.
2025-06-14fix(window): don't enter unfocusable or hidden prevwin (#34486)luukvbaal1
Problem: When closing a floating window, the next window to be entered may be unfocusable or hidden. Solution: Don't enter prevwin when it is unfocusable or hidden. Enter firstwin instead (like for when prevwin is no longer valid).
2025-04-28refactor(ui): separate types for allocated grids and viewportsbfredl1
2025-02-14fix(float): "Not enough room" error for 1-line float #25192glepnir1
Problem: set winbar on a floating window which only have one row will cause crash. Solution: when new floating window only have one room don't copy winbar from target window" Fix #19464
2025-01-14feat(api): nvim_open_win() relative to tabline and laststatus #32006luukvbaal1
Problem: Anchoring a floating window to the tabline and laststatus is cumbersome; requiring autocommands and looping over all windows/tabpages. Solution: Add new "tabline" and "laststatus" options to the `relative` field of nvim_open_win() to place a window relative to.
2025-01-09Revert "refactor(options): set option value for non-current context ↵zeertzjq1
directly" (#31924) Reverts #31112
2024-12-26refactor(options): set option value for non-current context directlyFamiu Haque1
Problem: Currently, we use `switch_option_context` to temporarily switch the current option context before setting an option for a different buffer / window. This is not ideal because we already support getting and setting option values for non-current contexts in the underlying implementation. Solution: Set option value for non-current context by passing the context directly to the lower level functions. Also introduce a new `OptCtx` struct to store option context information, this will scale much better if we add more option scopes and other context information in the future.
2024-12-23refactor: iwyu #31637Justin M. Keyes1
Result of `make iwyu` (after some "fixups").
2024-11-16refactor(options): remove `.indir`, redesign option scopes #31066Famiu Haque1
Problem: The way option scopes currently work is inflexible and does not allow for nested option scopes or easily finding the value of an option at any arbitrary scope without having to do long handwritten switch-case statements like in `get_varp()`. `.indir` is also confusing and redundant since option indices for each scope can be autogenerated. Solution: Expand option scopes in such a way that an option can support any amount of scopes using a set of scope flags, similarly to how it's already done for option types. Also make options contain information about its index at each scope it supports. This allows for massively simplifying `get_varp()` and `get_varp_scope()` in the future by just using a struct for options at each scope. This would be done by creating a table that stores the offset of an option's variable at a scope by using the option's index at that scope as a key. This PR also autogenerates enums for option indices at each scope to remove the need for `.indir` entirely, and also to allow easily iterating over options all options that support any scope. Ref: #29314
2024-10-24fix(options): missing error check for global 'scl' and 'winhl' (#30919)zeertzjq1
2024-10-20feat(float): allow enabling mouse for non-focusable window (#30844)zeertzjq1
Problem: Cannot allow mouse interaction for non-focusable float window. Solution: Add a "mouse" field to float window config.
2024-09-29fix(float): properly find last window of tabpage (#30571)zeertzjq1
2024-09-28fix(window): making float with title/footer non-float leaks memory (#30551)zeertzjq1
2024-09-27fix(api): fix crash/leak with float title/footer on error (#30543)zeertzjq1
2024-07-17fix(float): handle error in win_float_create() (#29742)glepnir1
Problem: Missing error handling in win_float_create() function. Solution: Add an inline function for error handling.
2024-06-01refactor: move shared messages to errors.h #26214Justin M. Keyes1
2024-04-25fix(completion): improve popup window position (#26739)Raphael1
2024-04-25feat(api): allow floats to be opened in non-current tabpage (#28480)Will Hopkins1
\
2024-04-21fix(float): wrong position when bufpos is setglepnir1
Problem: when lnum in bufpos is out of range the position of float is wired. Solution: avoid the height value out of buffer line range.
2024-03-09fix(api): win_set_config set tp_curwin of win moved from other tabpageSean Dewar1
Problem: nvim_win_set_config does not update the tp_curwin of win's original tabpage when moving it to another. Solution: update it if win was the tp_curwin. Add a test.
2024-03-08fix(api): patch some cmdwin/textlock holesSean Dewar1
Problem: there are new ways to escape textlock or break the cmdwin in nvim_win_set_config and nvim_tabpage_set_win. Solution: fix them. Use win_goto to check it in nvim_tabpage_set_win and use the try_start/end pattern like with similar functions such as nvim_set_current_win (which uses the existing msg_list, if set). Careful not to use `wp->handle` when printing the window ID in the error message for nvim_tabpage_set_win, as win_goto autocommands may have freed the window. On a related note, I have a feeling some API functions ought to be checking curbuf_locked...
2024-03-08fix(api): handle win_split_ins failure properlySean Dewar1
Problem: nvim_win_set_config does not handle failure in win_split_ins properly yet, which can cause all sorts of issues. Also nvim_open_win and nvim_win_set_config do not set the error message to the one from win_split_ins. Solution: handle failure by undoing winframe_remove, like in win_splitmove. Make sure autocommands from switching to the altwin fire within a valid window, and ensure they don't screw things up. Set the error message to that of win_split_ins, if any. Also change a few other small things, including: - adjust win_append to take a tabpage_T * argument, which is more consistent with win_remove (and also allows us to undo a call to win_remove). - allow winframe_restore to restore window positions. Useful if `wp` was in a different tabpage, as a call to win_comp_pos (which only works for the current tabpage) after winframe_restore should no longer be needed. Though enter_tabpage calls win_comp_pos anyway, this has the advantage of ensuring w_winrow/col remains accurate even before entering the tabpage (useful for stuff like win_screenpos, if used on a window in another tabpage). (This change should probably also be PR'd to Vim later, even though it doesn't use winframe_restore for a `wp` in a different tabpage yet).
2024-03-08vim-patch:9.1.0118: Use different restoration strategy in win_splitmoveSean Dewar1
Problem: saving and restoring all frames to split-move is overkill now that WinNewPre is not fired when split-moving. Solution: defer the flattening of frames until win_split_ins begins reorganising them, and attempt to restore the layout by undoing our changes. (Sean Dewar) https://github.com/vim/vim/commit/704966c2545897dfcf426dd9ef946aeb6fa80c38 Adjust winframe_restore to account for Nvim's horizontal separators when the global statusline is in use. Add a test.
2024-02-13vim-patch:9.0.0245: mechanism to prevent recursive screen updating is ↵zeertzjq1
incomplete (#27448) Problem: Mechanism to prevent recursive screen updating is incomplete. Solution: Add "redraw_not_allowed" and set it in build_stl_str_hl(). (issue vim/vim#10952) https://github.com/vim/vim/commit/471c0fa3eed4f6207d1cb7636970547bfd2eee26 Co-authored-by: Bram Moolenaar <Bram@vim.org>
2024-02-10refactor: rename w_float_config to w_config #27419Will Hopkins1
Follows up on rename of `FloatConfig` to `WinConfig` in #27397.
2024-02-10refactor: don't use subtraction in qsort() comparison functionszeertzjq1
2024-02-09refactor: rename FloatConfig to WinConfig #27397Will Hopkins1
`FloatConfig` is no longer used only for floats, so the name is counterintuitive. Followup to #25550
2024-01-11refactor(IWYU): fix headersdundargoc1
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.
2024-01-02fix(clangd): check size of array before applying qsort on itsus-domesticus1
2023-12-30refactor: follow style guidedundargoc1
2023-12-20refactor: eliminate cyclic includesdundargoc1
2023-12-18docs: add style rule regarding initializationdundargoc1
Specifically, specify that each initialization should be done on a separate line.
2023-12-16feat(ui): completeopt support popup like vimmathew1
2023-11-30build: don't define FUNC_ATTR_* as empty in headers (#26317)zeertzjq1
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.
2023-11-28refactor: fix headers with IWYUdundargoc1
2023-11-27build(IWYU): fix includes for undo_defs.hdundargoc1
2023-11-27build(IWYU): fix includes for func_attr.hdundargoc1
2023-11-16refactor: iwyu (#26062)zeertzjq1