Commit Graph

100 Commits

Author SHA1 Message Date
bfredl
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
Luuk van Baal
037ea6e786 feat(api): add nvim__redraw for more granular redrawing
Experimental and subject to future changes.
Add a way to redraw certain elements that are not redrawn while Nvim is waiting
for input, or currently have no API to do so. This API covers all that can be
done with the :redraw* commands, in addition to the following new features:
- Immediately move the cursor to a (non-current) window.
- Target a specific window or buffer to mark for redraw.
- Mark a buffer range for redraw (replaces nvim__buf_redraw_range()).
- Redraw the 'statuscolumn'.
2024-05-02 15:57:06 +02:00
dundargoc
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
Lewis Russell
81fc27124b refactor(test): inject after_each differently 2024-04-10 15:53:50 +01:00
bfredl
3d44340cea fix(tests): use more global highlight definitions 2024-04-09 09:09:41 +02:00
dundargoc
7035125b2b test: improve test conventions
Work on https://github.com/neovim/neovim/issues/27004.
2024-04-08 22:51:00 +02:00
zeertzjq
1da0f3494e
test: correct order of arguments to eq() (#27816) 2024-03-11 22:23:14 +08:00
zeertzjq
35ffe58ea4
fix(inccommand): update topline after moving cursor (#27341) 2024-02-05 12:13:21 +08:00
zeertzjq
ba9f86a9ce
fix(inccommand): improve preview buffer number handling (#27087) 2024-01-19 11:04:01 +08:00
Lewis Russell
795f896a57 test: rename (meths, funcs) -> (api, fn) 2024-01-12 18:59:14 +00:00
Lewis Russell
4f81f506f9 test: normalise nvim bridge functions
- remove helpers.cur*meths
- remove helpers.nvim
2024-01-12 17:53:27 +00:00
Lewis Russell
c30f2e3182 test: typing for helpers.meths 2024-01-12 13:01:06 +00:00
Lewis Russell
7a259d01ae test: remove helpers.sleep() 2024-01-12 12:04:19 +00:00
Justin M. Keyes
04f2f864e2 refactor: format test/* 2024-01-03 02:09:29 +01:00
zeertzjq
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
zeertzjq
93011add10 test(inccommand_spec): actually trigger 'inccommand' preview 2023-12-07 15:32:56 +08:00
zeertzjq
1dba570e63
fix(inccommand): save and restore '[ and '] marks (#26442)
Undoing a change moves '[ and '] marks, so it is necessary to save and
restore them.
2023-12-07 12:04:02 +08:00
Omar El Halabi
9af03bcd47
fix(options): do not change inccommand during preview (#25462) 2023-11-09 22:20:26 -06:00
zeertzjq
366d0c7887
fix(move): check the correct buffer (#25698) 2023-10-18 10:34:55 +08:00
zeertzjq
bf70a33f5e
vim-patch:8.1.0822: peeking and flushing output slows down execution (#25629)
Problem:    Peeking and flushing output slows down execution.
Solution:   Do not update the mode message when global_busy is set.  Do not
            flush when only peeking for a character. (Ken Takata)

cb574f4154
2023-10-14 09:58:30 +08:00
zeertzjq
c1c2a1b5dd
fix(inccommand): don't save information of a buffer twice (#24501)
Problem:    'inccommand' doesn't restore 'undolevels' properly for a
            buffer shown in multiple windows.
Solution:   Don't save information of a buffer twice.
2023-07-28 15:41:58 +08:00
zeertzjq
b60a2ab4cb
fix(inccommand): block errors when parsing command line again (#24374)
Revert the change to ex_getln.c from a741c7fd04
2023-07-17 10:15:45 +08:00
Lewis Russell
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
zeertzjq
4a098b97e5 fix(excmd): append original command to error message
Revert the change to do_cmdline_cmd() from #5226.

This function is used in many places, so making it different from Vim
leads to small differences from Vim in the behavior of some functions
like execute() and assert_fails(). If DOCMD_VERBOSE really needs to be
removed somewhere, a do_cmdline() call without DOCMD_VERBOSE is also
shorter than a do_cmdline() call with DOCMD_VERBOSE.
2023-05-05 10:43:28 +08:00
zeertzjq
d321deb4a9
test: fix dependencies between test cases (#23343)
Discovered using --shuffle argument of busted.
2023-04-27 15:51:44 +08:00
zeertzjq
05faa8f30a
test: make expect_unchanged() less confusing (#22255)
Problem:
The sleep before collecting the initial screen state is confusing and
may lead to unexpected success if it comes after a blocking RPC call.

Solution:
Remove that sleep and add an "intermediate" argument.
2023-02-15 07:26:55 +08:00
zeertzjq
a6c9764eda
fix(inccommand): deal with unsynced undo (#20041) 2022-09-26 07:00:37 +08:00
zeertzjq
7bd4c8e8ee
fix(inccommand): avoid unnecessary redraw when not showing (#20244) 2022-09-19 12:37:25 +08:00
bfredl
068a998e60 fix(tests): remove irrelevant usage of display-=msgsep
These were just added to avoid churn when changing the default
of 'display'. To simplify message handling logic, we might want
to remove support for printing messages in default_grid later on.
This would allow things like printing error messages safely in the
middle of redraw, or a future graduation of the 'multigrid' feature.
2022-08-17 23:44:49 +02:00
zeertzjq
664efa497e
vim-patch:8.2.0614: get ml_get error when deleting a line in 'completefunc' (#19244)
Problem:    Get ml_get error when deleting a line in 'completefunc'. (Yegappan
            Lakshmanan)
Solution:   Lock the text while evaluating 'completefunc'.
ff06f283e3

Fix a mistake in the porting of patch 8.1.0098.
Cherry-pick Test_run_excmd_with_text_locked() from patch 8.2.0270.
Cherry-pick test_gf.vim changes from patch 8.2.0369.
Cherry-pick message change from later patches.
2022-07-07 04:47:18 +08:00
Famiu Haque
7e1cf6b764
fix(inccommand): parse the command to check if it is previewable
Free regprog if command isn't previewable

Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2022-06-28 13:00:05 +08:00
Justin M. Keyes
f977f9445f refactor(tests): introduce testprg()
Also:
- Add a describe('shell :!') section to system_spec.
- Make the test for #16271 work on systems without powershell.
2022-06-25 08:27:17 -07:00
zeertzjq
1493efdc14
test: correct check for v:errmsg in inccommand test (#18968)
After the first separator is typed v:errmsg can be set.
Check for its value before typing the first separator.
2022-06-15 10:18:43 +08:00
zeertzjq
619eb32c75
fix(inccommand): never preview if parsing command failed (#18944)
`errormsg` is not always set when parsing the command failed (e.g. when
the range contains invalid marks). Check the return value is better.
2022-06-14 10:55:04 +08:00
Famiu Haque
2de0d67144
fix(inccommand): skip split window if not enough room #18937
Command preview now behaves like inccommand=nosplit when there's not
enough room for the preview window to be opened instead of aborting,
which is consistent with old behavior of 'inccommand'.
2022-06-12 10:59:04 -07:00
zeertzjq
2b539d6fdf
fix(inccommand): clear cmdpreview state if preview is not shown (#18923) 2022-06-11 13:04:19 +08:00
Famiu Haque
46536f53e8 feat: add preview functionality to user commands
Adds a Lua-only `preview` flag to user commands which allows the command to be incrementally previewed like `:substitute` when 'inccommand' is set.
2022-05-31 20:55:05 +06:00
zeertzjq
d4bb15af52
test: add tests for inccommand with c_CTRL-R_= and c_CTRL-\_e (#18796) 2022-05-29 20:52:53 +08:00
bfredl
e01c197eab fix(tests): fix some issues with ui/inccommand_spec.lua causing slowness
from ~30 to ~20 secs with ASAN build

- feedkeys test: the same substitute was repeated, and not even correctly spelled
- don't clear() in a tight loop. "bwipe!" is enough to erase undo history
- error in cnoremap mapping causes a check_for_delay(). <c-c> it away.
2022-05-22 16:17:37 +02:00
Famiu Haque
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
zeertzjq
d11bbacf0f fix(inccommand): do not change reg_prev_sub when previewing 2022-01-25 16:18:58 +08:00
itchyny
1f8c91bf72
fix(inccommand): ignore trailing commands only for *previewed* command #15638
Since the `State` is global, other scripts are unexpectedly affected during the
'inccommand' preview. This commit introduces a new flag for `do_cmdline`, in
order to ignore trailing '|'-separated commands only for the command invoking
the preview.

fix #8796, update #7494
2021-09-20 07:33:10 -07:00
Björn Linse
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
erw7
620c8fdfe9 extmark: fix decoration ploblems with extmark
54ce101 changed the way undo entries are created when adding decorations.
This creates all sorts of problems.This change fixes the problem by
reverting to the previous behavior.
2020-10-02 11:41:30 +09:00
Aufar Gilbran
e8a8b9ed08 vim-patch:8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Problem:    'incsearch' doesn't work for :s, :g or :v.
Solution:   Also use 'incsearch' for other commands that use a pattern.
b0acacd767
2020-09-11 10:31:41 +08:00
Björn Linse
459a362cc1 extmarks: fix crash due to invalid column values in inccommand preview
This used to use -1 and MAXCOL values. Make sure in range values are
used.
2020-02-02 10:50:48 +01:00
Rob Pilling
d04ab11f24 Prevent prompts during inccommand previews
For example, "Backwards range given, OK to swap (y/n)?" on each keypress.
2019-10-31 19:22:22 +00:00
Rob Pilling
d52d782389 Prevent :topleft, etc modifying the inccommand preview window 2019-10-31 19:16:52 +00:00
Rob Pilling
1c7aa11312 Allow multiple leading colons before and after modifiers for 'inccommand' 2019-10-31 19:16:52 +00:00
Rob Pilling
d4384cbbf3 Remove unnecessary expr in 'icm' test 2019-10-31 18:55:43 +00:00