summaryrefslogtreecommitdiffstatshomepage
path: root/test/functional/ui/input_spec.lua
AgeCommit message (Collapse)AuthorFiles
2025-12-15refactor(test): deprecates functions in some tests #36972glepnir1
Problem: feed_command, nvim_buf_set_option, nvim_buf_get_number, and exc_exec are marked as deprecated. Solution: Remove them from the test units in api/buffer_spec, autocmd/focus_spec, ui/input_spec, and editor/put_spec. Some test units only used a few deprecated functions, so creating a separate PR for each would be excessive. Therefore, several were combined into a single PR.
2025-02-20fix(keycodes): recognize <Find>, <Select> #28431Mantas Mikulėnas1
PuTTY sets TERM=xterm, but sends ESC[1~ and ESC[4~ for Home/End keys, which does not match what the 'xterm' terminfo has for khome/kend, so libtermkeys instead reports them as the original DEC VT220 names. The VT220 came with a DEC LK201 keyboard which had the following keys in the area above arrow keys (where PCs now have Ins/Del/Home/End/etc): ┌────────┬────────┬────────┐ │ Find │ Insert │ Re- │ │ │ Here │ move │ ├────────┼────────┼────────┤ │ Select │ Prev │ Next │ │ │ Screen │ Screen │ └────────┴────────┴────────┘ These would send ESC[x~ sequences in the expected order: ┌────────┬────────┬────────┐ │ ESC[1~ │ ESC[2~ │ ESC[3~ │ ├────────┼────────┼────────┤ │ ESC[4~ │ ESC[5~ │ ESC[6~ │ └────────┴────────┴────────┘ Modern terminals continue to use the same sequences for Ins/Del as well as PageUp/PageDn. But the VT220 keyboard apparently had no Home/End, and PuTTY apparently chose to re-purpose the Find/Select key sequences for Home/End (even though it claims to emulate Xterm and this doesn't match what actual Xterm does). So when Home/End are used in Neovim through PuTTY with TERM=xterm (the default setting), libtermkey finds no match for the received sequences in the terminfo database and defaults to reporting them as <Find> and <Select> respectively. PuTTY is not unique here -- tmux *also* sends ESC[1~ and ESC[4~ after its internal translation -- but the difference is that 'tmux' terminfo correctly maps them to Home/End so Neovim recognizes them as such, while PuTTY defaults to using 'xterm' which uses a different mapping. This initial patch only allows Neovim to recognize <Find> and <Select> key codes as themselves, so that the user could manually map them e.g. using ":imap <Find> <Home>". Alternatives: - Using TERM=putty(-256color) would of course be the most correct solution, but in practice it leads to other minor issues, e.g. the need to have different PuTTY config profiles for older or non-Linux systems that lack that terminfo, or tmux's insistence on rendering italics as reverse. - Using Neovim through tmux avoids the problem (as tmux recognizes ESC[1~ on input), but is something that needs to be manually run every time. The keycodes.h constants are slightly misnamed because K_SELECT was already taken for a different purpose.
2025-01-02feat(ui)!: emit prompt "messages" as cmdline events #31525luukvbaal1
Problem: Prompts are emitted as messages events, where cmdline events are more appropriate. The user input is also emitted as message events in fast context, so cannot be displayed with vim.ui_attach(). Solution: Prompt for user input through cmdline prompts.
2024-11-14fix(tests): needing two calls to setup a screen is cringebfredl1
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-04-23test: improve test conventionsdundargoc1
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-10refactor(test): inject after_each differentlyLewis Russell1
2024-04-08test: improve test conventionsdundargoc1
Work on https://github.com/neovim/neovim/issues/27004.
2024-04-06test: reduce sleep for file timestamp change (#28196)zeertzjq1
Now that Nvim always supports nanotime, sleeping for some milliseconds is enough.
2024-03-26refactor(tests): use new global defaults instead of set_default_attr_idsbfredl1
This will be done in batches.
2024-02-03fix(keycodes): simplify S- properly when D- is present (#27316)zeertzjq1
2024-01-12test: rename (meths, funcs) -> (api, fn)Lewis Russell1
2024-01-12test: typing for helpers.methsLewis Russell1
2024-01-12test: remove helpers.sleep()Lewis Russell1
2024-01-03refactor: format test/*Justin M. Keyes1
2023-12-09test: avoid repeated screen lines in expected stateszeertzjq1
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
2022-08-17fix(tests): remove irrelevant usage of display-=msgsepbfredl1
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-05-13revert: "feat(mappings): do not simplify the rhs of a mapping" (#18553)zeertzjq1
This reverts commit 7ac5359143ef25c4c8c0c427d5533f8d5824ed17. This fix can cause more problems than it solves.
2022-04-29feat(mappings): do not simplify the rhs of a mappingzeertzjq1
2022-04-29feat(mappings): do not replace existing mapping for simplified formzeertzjq1
2022-04-29vim-patch:8.2.4504: when there is a partially matching map full map may not workzeertzjq1
Problem: When there is a partially matching map and modifyOtherKeys is active a full map may not work. Solution: Only simplify modifiers when there is no matching mapping. (closes vim/vim#8792) https://github.com/vim/vim/commit/196c3850dbe95247f7aa1b0000a5cae625a99ef2 Omit test as it sends terminal codes. Use a Lua test instead.
2022-04-29vim-patch:8.1.2346: CTRL-R CTRL-R doesn't work with modifyOtherKeyszeertzjq1
Problem: CTRL-R CTRL-R doesn't work with modifyOtherKeys. Solution: Allow key codes when fetching argument for CTRL-R. (closes vim/vim#5266) Also fix CTRL-G in Insert mode. https://github.com/vim/vim/commit/38571a04b4eb2853f46df8884750bcb9a8115db8 Omit test as it sends terminal codes. Use a Lua test instead.
2022-04-29vim-patch:8.2.0916: mapping with partly modifyOtherKeys code does not workzeertzjq1
Problem: Mapping with partly modifyOtherKeys code does not work. Solution: If there is no mapping with a separate modifier include the modifier in the key and then try mapping again. (closes vim/vim#6200) https://github.com/vim/vim/commit/975a880a1389e8ce6dea8d66a7c109140b2f94ec Cherry-pick applicable part of put_string_in_typebuf(). Revert related changes from 10a5825. Use KEYLEN_PART_KEY for incomplete modifier sequence. Omit test as it sends terminal codes. Use a Lua test instead.
2022-04-29vim-patch:8.2.0839: dropping modifier when putting a character back in typeaheadzeertzjq1
Problem: Dropping modifier when putting a character back in typeahead. Solution: Add modifier to ins_char_typebuf(). (closes vim/vim#6158) https://github.com/vim/vim/commit/b42c0d54279b1fdb79652db0c84171e213458809 Vim's test doesn't seem to work properly as the hit-enter prompt seems to be delayed. Add a Lua screen test.
2022-04-11feat(keymap): add F38-F63 keys (#17893)zeertzjq1
2022-04-09vim-patch:partial:8.1.2333: with modifyOtherKeys CTRL-^ doesn't work (#18048)zeertzjq1
Problem: With modifyOtherKeys CTRL-^ doesn't work. Solution: Handle the exception. https://github.com/vim/vim/commit/828ffd596394f714270a01a55fc3f949a8bd9b35
2022-03-30fix(event-loop): duplicate display updating logic in vgetorpeek() (#17913)zeertzjq1
2022-03-24feat(input): enable <tab>/<c-i>, <cr>/<c-m>, <esc>/<c-[> pairs unconditionallybfredl1
2022-02-06Merge pull request #17279 from zeertzjq/state-enter-vpeekcbfredl1
fix(event-loop): call vpeekc() directly first to check for character
2022-02-04vim-patch:8.2.1128: the write message mentions characters, but it's byteszeertzjq1
Problem: The write message mentions characters, but it's actually bytes. Solution: Change "C" to "B" and "characters" to "bytes". https://github.com/vim/vim/commit/3f40ce78f5c178d15871bd784ed878c78f0b8a44
2022-02-03fix(event-loop): call vpeekc() directly first to check for characterzeertzjq1
Expand mappings first by calling `vpeekc()` directly.
2022-01-21fix(input): never escape CSI byteszeertzjq1
2021-03-08state: throttle batched event processing when input is availableBjörn Linse1
before, calling vim.schedule() from inside an event would execute the scheduled callback immediately after this event without checking for user input in between. Break event processing whenever user input or an interrupt is available.
2020-11-16keymap: Preserve S- modifier when C- is presentJames McCoy1
Closes #12037
2019-08-27paste: use nvim_put()Justin M. Keyes1
2019-08-27paste: WIP #4448Justin M. Keyes1
2019-08-16keymap: allow modifiers to multibyte chars, like <m-ä>Björn Linse1
2019-03-31keymap, terminal: more keycodes #9810Olivier G-R1
- input: recognize <kEqual>, <kComma> - terminal.c: If we need to support function key, a change must be made in libvtermkey. Currently, it emulates strictly VT220 terminal, and returning numeric value in 'normal' mode is the expected behaviour. closes #9810
2019-03-29keymap: add more (keypad) keycodes #9793Olivier G-R1
- K_KORIGIN instead of K_KCENTER: This name is similar to what is used by xev. Alternative could be K_KBEGIN as hinted here: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-PC-Style-Function-Keys But I find Begin and Home too similar, and it might induced some confusion. The naming looked related to some old keyboard configuration. - keymap.c: alias KPPeriod to kDel instead of kPoint. This might seems weird, but this is actually the behaviour that should be expected. libtermkey produces "KPPeriod" when num lock is off. To fix this would need to change this name in termkey. closes #9780 closes #9793
2019-01-01Mark "feeding large chunks of input with <Paste>" fragileJames McCoy1
2018-06-22defaults: shortmess+=F (#8619)Justin M. Keyes1
Because we default to laststatus=2 (statusline is always visible), the :edit message is not useful. ref #6289
2018-04-11test/util: expect_err() (#8257)Justin M. Keyes1
other cleanup, ref #8245
2018-03-31msg: do not scroll entire screen (#8088)Björn Linse1
2018-03-11test: rename next_message() to next_msg()Justin M. Keyes1
2018-03-04message: don't output unprintable chars to screenBjörn Linse1
fixes #7586 #8070
2018-01-06win: enable more functional testsJan Edmund Lazo1
- plugin/shada_spec.lua: Use \r\n as Windows EOL for tests on BufWriteCmd, FileWriteCmd, FileAppendCmd. Alternative is 'set fileformat=unix'.
2017-04-09functests: Replace execute with either command or feed_commandZyX1
Hope this will make people using feed_command less likely: this hides bugs. Already found at least two: 1. msgpackparse() will show internal error: hash_add() in case of duplicate keys, though it will still work correctly. Currently silenced. 2. ttimeoutlen was spelled incorrectly, resulting in option not being set when expected. Test was still functioning somehow though. Currently fixed.
2016-08-26Mark some functional tests as pending in WindowsRui Abreu Ferreira1
2016-06-10functests: Check logs in lua codeZyX1
It is otherwise impossible to determine which test failed sanitizer/valgrind check. test/functional/helpers.lua module return was changed so that tests which do not provide after_each function to get new check will automatically fail.
2016-02-22keymap: Support <D-...> (super/command key).Justin M. Keyes1
Adds support for: - api:vim_input("<D-a>") - ":nnoremap <C-D-S-...>" and permutations thereof UIs must capture the modifier and send it as "<D-...>" to vim_input(). Note: Before this commit, any arbitrary ":nnoremap <{foo}-{bar}>" mapping could already be invoked with feedkeys("\<{foo}-{bar}>"). This commit supports "D-" as a modifier that can be combined with "C-", "A-", "S-" in any order. For non-GUI (terminal) support, user must: :set <D-a>={CSI sequence} then send the {CSI sequence} from their terminal. But this does not work yet (regression #2204). Closes #2190
2015-11-23test/functional: clean up according to luacheck (part 1)Marco Hinz1