Commit Graph

56 Commits

Author SHA1 Message Date
f5b5f2095e refactor(tests): lint decorations_spec, float_spec, multigrid_spec #33274
Problem:
decorations_spec.lua, float_spec.lua, multigrid_spec.lua are not
auto-formatted.

Solution:
Add a special `formatlua2` cmake target, which invokes `stylua` with
an alternative `.stylua2.toml` config.
2025-05-06 18:00:20 -07:00
fc2dee1736 feat(messages): cleanup Lua error messages
"Error" in error messages is redundant. Just provide the context, don't
say "Error ...".
2025-05-04 11:22:57 -04:00
28e31f5d3d feat(options): default statusline expression #33036
Problem:
Default 'statusline' is implemented in C and not representable as
a statusline expression. This makes it hard for user configs/plugins to
extend it.

Solution:
- Change the default 'statusline' slightly to a statusline expression.
- Remove the C implementation.
2025-04-21 15:05:34 -07:00
f29856d034 feat(ui): include compositor info with multigrid
Provide compositor information, like composition index and absolute
position.
2025-04-15 10:52:57 +02:00
424d30fe97 fix(ui): send multigrid message position and size when the UI is refreshed 2025-03-27 18:41:57 +07:00
af0cd9a907 test: screen.lua can check win_pos #32373
Also remove a hack in the multigrid "with winbar" test.
2025-02-09 07:31:14 -08:00
09e01437c9 refactor: use nvim.foo.bar format for autocommand groups 2025-01-14 21:25:25 -08:00
e61228a214 fix(tests): needing two calls to setup a screen is cringe
Before calling "attach" a screen object is just a dummy container for
(row, col) values whose purpose is to be sent as part of the "attach"
function call anyway.

Just create the screen in an attached state directly. Keep the complete
(row, col, options) config together. It is still completely valid to
later detach and re-attach as needed, including to another session.
2024-11-14 12:40:57 +01:00
7eba016c86 fix(ui): ensure screen update before waiting for input #30576
Ensure the screen is fully updated before blocking for input. This did
not always happen before, for example when setting `cursorline
scrolloff=9999`, which lead to jerky movement when using some GUI
applications.

Because of the duality of redraw_later, this can't be done in
command-line or when waiting for "Press ENTER". In many of those cases
the redraw is expected AFTER the key press, while normally it should
update the screen immediately. So, those special cases are excluded.
2024-10-03 02:31:17 -07:00
76aa3e52be feat(defaults): popupmenu "Open in browser", "Go to definition" #30261
- Use the popup to expose more features such as LSP and gx.
- Move the copy/paste items lower in the menu, they are lower priority.
2024-09-05 05:56:00 -07:00
5947f249f8 fix(move): half-page scrolling with resized grid at eob (#28821) 2024-05-18 07:00:29 +08:00
052498ed42 test: improve test conventions
Specifically, functions that are run in the context of the test runner
are put in module `test/testutil.lua` while the functions that are run
in the context of the test session are put in
`test/functional/testnvim.lua`.

Closes https://github.com/neovim/neovim/issues/27004.
2024-04-23 18:17:04 +02:00
81fc27124b refactor(test): inject after_each differently 2024-04-10 15:53:50 +01:00
7035125b2b test: improve test conventions
Work on https://github.com/neovim/neovim/issues/27004.
2024-04-08 22:51:00 +02:00
2e4e12756a feat(ui): indicate margins for the area used by win_viewport
Problem: using win_viewport for implementing smooth scrolling in an external
UI might run into problems when winbar or borders is used, as there is
no indication that the entire grid is not used for scrolled buffer text.

Solution: add `win_viewport_margins` event.
2024-03-29 08:15:28 +01:00
a0cbf1d8d5 fix(plines): cursor position with 'showbreak' and resized grid (#28067) 2024-03-28 14:12:54 +08:00
31b3c62845 vim-patch:9.1.0106: Visual highlight hard to read with 'termguicolors'
Problem:  Visual highlight hard to read with 'termguicolors'
          (Maxim Kim)
Solution: Set Visual GUI foreground to black (with background=light)
          and lightgrey (with background=dark)
          (Maxim Kim)

fixes: vim/vim#14024
closes: vim/vim#14025

34e4a05d02

Co-authored-by: Maxim Kim <habamax@gmail.com>
2024-02-15 10:50:29 +08:00
8f02ae82e2 test: use integers for API Buffer/Window/Tabpage EXT types 2024-01-16 19:11:49 +00:00
795f896a57 test: rename (meths, funcs) -> (api, fn) 2024-01-12 18:59:14 +00:00
4f81f506f9 test: normalise nvim bridge functions
- remove helpers.cur*meths
- remove helpers.nvim
2024-01-12 17:53:27 +00:00
c30f2e3182 test: typing for helpers.meths 2024-01-12 13:01:06 +00:00
d956bc6379 fix(options): setting 'scroll' with resized grid (#26628) 2023-12-18 10:15:23 +08:00
1037ce2e46 test: avoid repeated screen lines in expected states
This is the command invoked repeatedly to make the changes:

    :%s/^\(.*\)|\%(\*\(\d\+\)\)\?$\n\1|\%(\*\(\d\+\)\)\?$/\=submatch(1)..'|*'..(max([str2nr(submatch(2)),1])+max([str2nr(submatch(3)),1]))/g
2023-12-09 22:15:02 +08:00
10cabf7877 refactor(grid): use batched updates for statusline and ruler 2023-09-27 11:31:45 +02:00
adb73772d9 vim-patch:9.0.1919: Wrong curswant when clicking on empty line or with vsplits
Problem:  Wrong curswant when clicking on empty line or with vsplits.
Solution: Don't check for ScreenCols[] before the start of the window
          and handle empty line properly.

closes: vim/vim#13132

03cd697d63
2023-09-21 09:43:12 +08:00
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
a76b689b47 perf(ui-ext): approximate scroll_delta when scrolling too much (#24234) 2023-07-04 16:48:53 +08:00
e8b3ed74bc fix(ui-ext): "scroll_delta" handle topfill and skipcol (#24249) 2023-07-04 14:14:09 +08:00
1fe1bb084d refactor(options): deprecate nvim[_buf|_win]_[gs]et_option
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Co-authored-by: famiu <famiuhaque@protonmail.com>
2023-05-21 15:14:01 +06:00
540941ef83 fix(pum): don't position too far with resized parent grid (#23442) 2023-05-03 06:17:53 +08:00
7c1921e9d6 fix(mouse): fix popup_setpos position check with ext_multigrid (#23436) 2023-05-02 15:25:41 +08:00
088cdf69e3 fix(normal): make "g$" work properly with resized grid 2023-05-02 12:04:49 +08:00
37b73cf14b fix(drawline): make cursorlineopt=screenline work with resized grid 2023-05-02 12:04:49 +08:00
03e8b5fc91 fix(float): make bufpos work properly with resized parent grid 2023-05-02 12:04:48 +08:00
fd2ece278b feat(ui): add scroll_delta to win_viewport event #19270
scroll_delta contains how much the top line of a window moved since the
last time win_viewport was emitted. It is expected to be used to
implement smooth scrolling. For this purpose it only counts "virtual" or
"displayed" so folds should count as one line. Because of this it
adds extra information that cannot be computed from the topline
parameter.

Fixes #19227
2023-03-12 15:58:46 -07:00
0badfaa6d0 test: adding/removing winbar should not cause win_pos events (#21226) 2022-11-29 08:56:41 +08:00
f91b1885dd feat(eval)!: make Vim functions return inner window width and height (#19743)
In non-multigrid UI the only change is that the returned height now
excludes winbar, and this is compatible with Vim.

In multigrid UI this means the return value of these functions now
reflect the space available for buffer lines in a window.

No change in nvim_win_get_height() and nvim_win_get_width().
2022-08-24 21:02:45 +08:00
0997884ae2 fix(mouse): fix mouse drag position with winbar 2022-05-19 19:16:31 +08:00
17758fe7ad fix(ui): make winbar work with floats and multigrid 2022-05-18 20:16:18 +02:00
bbf58e6bbc refactor(ui)!: link VertSplit to Normal by default
Avoids using `gui=reverse` on `VertSplit` and makes window separators
look much nicer by default.
2022-05-15 22:37:35 +06:00
086631cd92 feat(api): win_viewport also sends line_count #15613 2021-09-10 19:19:39 -07:00
0dcfd0e8d1 fix(mouse.c): fix mouse drag positions on multigrid #12667
Currently, multigrid mouse drag positions are handled incorrectly if the
drag event is not in the top left grid. Fix this by not adjusting the
position of the event in jump_to_mouse.

related: #15091
2021-09-10 07:24:41 -07:00
28ac6c00e6 fix(multigrid): #15075 mouse events crash neovim 2021-09-08 01:57:40 +08:00
9601e7c5d5 ui: Fix win_hide distination grid
When create tab, win_hide sent to new tab and new tab's previous tab.
So, if created tab that not next tab (eg. $tabnew cmd),
send win_hide to not current tab, and fixed this.
2020-12-05 20:18:51 +09:00
07cc231142 A Mudholland Dr. Recast
The commit summary maybe does not make sense, but calling a function
that does not wait on anything `wait()` makes even less sense.
2020-10-19 21:48:06 +02:00
1fe0b329fe api/ui: win_viewport event for visible range and cursor position in window 2020-04-01 19:43:55 +02:00
4987311fb5 tests/ui: remove unnecessary screen:detach()
It is perfectly fine and expected to detach from the screen just by
the UI disconnecting from nvim or exiting nvim. Just keep detach() in
screen_basic_spec, to get some coverage of the detach method itself.

This avoids hang on failure in many situations (though one could argue
that detach() should be "fast", or at least "as fast as resize",
which works in press-return already).

Never use detach() just to change the size of the screen, try_resize()
method exists for that specifically.
2019-10-13 22:10:42 +02:00
e04b9e7c78 test/ui: update tests for new msg_grid implementation 2019-09-01 15:55:10 +02:00
6b2d67eb59 test/ui: properly test win_hide by explicitly marking hidden grids 2019-08-17 21:46:11 +02:00
3397b8c51a ui: use Window type in win_pos consistently with win_float_pos
Also check invalid positional arguments to screen:expect()
2019-08-17 20:52:08 +02:00