summaryrefslogtreecommitdiff
path: root/src/input_handler.hh
AgeCommit message (Collapse)Author
2025-03-24Default InputHandler::handle_key() synthesized argumentJohannes Altmanninger
We have only one place where we handle actual keys typed by the user.
2024-10-22Remove now unused CompletionFlagsMaxime Coste
Since shell-script-completions now runs the script asynchronously and unconditionally, there is no use for the CompletionFlags::Fast anymore which means we can remove that type altogether.
2024-08-15Remove unused ConstexprVector and rename constexpr_utils.hh to array.hhMaxime Coste
2024-08-12Reduce headers dependency graphMaxime Coste
Move more code into the implementation files to reduce the amount of code pulled by headers.
2024-07-22Handle word completion when recording macrosMaxime Coste
Make last insert and macro recording closer together, paving the way towards moving last insert to a register. Use a FunctionRef for insert completer key insertion support.
2024-04-01Fix std::optional used instead of OptionalMaxime Coste
2024-04-01Change mode_info to contain an optional NormalParamsMaxime Coste
As @topisani pointed out in #5131, it is more user friendly to always provide a %val{register} and %val{count} regardless of the mode.
2024-03-31Support exposing some env vars as part of the mode informationMaxime Coste
This should implement what #5131 proposed in a different way. Closes #5131
2023-11-20rc tools menu: replace menu builtin with a prompt-based implementationJohannes Altmanninger
prompt has fuzzy filtering which is more discoverable than the menu mode's regex filtering (because that one needs / to trigger it). There are no important differences left, so replace the menu builtin with a prompt-based command. prompt does not support markup in the completion menu, so drop that feature for now.
2023-11-14Make shell-script-candidates completer run in the backgroundMaxime Coste
Read output from the script as it comes and update the candidate list progressively. Disable updating of the list when a completion has been explicitely selected.
2023-09-02Do not make cursor visible after mouse scrolling and view commandsMaxime Coste
ensure cursor is visible after user input except if the command implementation opted-out. Hooks and timers should not enforce visible cursor. PageUp/PageDown and `<c-f>` / `<c-b>` commands still move the cursor as this seemed a desired behaviour.
2023-08-13Minor formatting tweaksMaxime Coste
2023-06-17Disable history only for prompts that are never shown in the UIJohannes Altmanninger
My terminal allows to map <c-[> and <esc> independently. I like to use <c-[> as escape key so I have this mapping: map global prompt <c-[> <esc> Unfortunately, this is not equivalent to <esc>. Since mappings are run with history disabled, <c-[> will not add the command to the prompt history. So disabling command history inside mappings is wrong in case the command prompt was created before mapping execution. The behavior should be: "a prompt that is both created and closed inside a noninteractive context does not add to prompt history", where "noninteractive" means inside a mapping, hook, command, execute-keys or evaluate-commands. Implement this behavior, it should better meet user expectations. Scripts can always use "set-register" to add to history. Here are my test cases: 1. Basic regression test (needs above mapping): :nop should be added to history<c-[> --- 2. Create the prompt in a noninteractive context: :exec %{:} now we're back in the interactive context, so we can type: nop should be added to history<ret> --- 3. To check if it works for nested prompts, first set up this mapping. map global prompt <c-j> '<a-semicolon>:nop should NOT be added to history<ret>' map global prompt <c-h> '<a-semicolon>:nop should be added to history first' Then type :nop should be added to history second<c-j><c-h><ret><ret> the inner command run by <c-j> should not be added to history because it only existed in a noninteractive context. --- See also the discussion https://github.com/mawww/kakoune/pull/4692 We could automate the tests if we had a test setup that allowed feeding interactive key input into Kakoune instead of using "execute-commands". Some projects use tmux, or maybe we can mock the terminal.
2023-03-11Implement bracketed pasteJohannes Altmanninger
Text pasted into Kakoune's normal mode is interpreted as command sequence, which is probably never what the user wants. Text pasted during insert mode will be inserted fine but may trigger auto-indentation hooks which is likely not what users want. Bracketed paste is pair of escape codes sent by terminals that allow applications to distinguish between pasted text and typed text. Let's use this feature to always insert pasted text verbatim, skipping keymap lookup and the InsertChar hook. In future, we could add a dedicated Paste hook. We need to make a decision on whether to paste before or after the selection. I chose "before" because that's what I'm used to. TerminalUI::set_on_key has EventManager::instance().force_signal(0); I'm not sure if we want the same for TerminalUI::set_on_paste? I assume it doesn't matter because they are always called in tandem. Closes #2465
2021-10-10Split InsertMode into InsertMode and PasteModeMaxime Coste
They are quite different use cases, and this allow moving InsertMode to input_handler.hh which is what uses it. This also cleans up the code as we can get rid of get_insert_pos and rely more on SelectionList::for_each.
2020-03-15Merge remote-tracking branch 'Anfid/scroll-test'Maxime Coste
2020-02-27Make `on_next_key_with_autoinfo()` respect `idle_timeout`Nicolas Ouellet-Payeur
The prompt and autocomplete normally wait for `idle_timeout` before showing suggestions, however commands like `g`, `v`, or the lead-key show Clippy instantly. This fixes the issue by making `on_next_key_with_autoinfo()` wait for `idle_timeout` before displaying suggestions. Fixes mawww/kakoune#3365 Fixes mawww/kakoune#2066
2019-11-28Update scroll behaviorMikhail Pogretskiy
2019-11-11Add mode information to next-key mode nameMaxime Coste
Currently expose an additional name, the format is up for discussion. Fixes #1855 Fixes #2569 Fixes #2672
2019-10-17Remove explicit sizes from make_array callsMaxime Coste
2019-09-15Allow scrolling while dragging mouseMaxime Coste
Closes #2052
2019-06-23Use register to store prompt historyMaxime Coste
2019-03-24Extract shell script completion code into structsMaxime Coste
2019-01-24Header and dependency cleanupMaxime Coste
2018-07-15Change autoshowcompl to auto_complete with insert|prompt possible valuesMaxime Coste
2018-06-03Add MenuStyle::Search that prevents the menu from hiding buffer textMaxime Coste
Fixes #2042
2017-11-12Move Array and ConstexprVector to a constexpr_utils.hh headerMaxime Coste
2017-11-08InputHandler: handle of last insert keys happening in nested modesMaxime Coste
Move recording of keys to the input handler itself instead of the Insert mode so that eventual nested modes (potentially introduced by <a-;> will get their keys recorded as well). Fixes #1680
2017-10-31Prompt: display the fallback text everytime the prompt is emptyMaxime Coste
2017-10-28Display the fallback value in promptsMaxime Coste
Fixes #1654
2017-08-18Respecify EnumDescs array sizes manually to workaround clang-3.6 bugMaxime Coste
2017-08-12Remove size redundancy in enum_desc function declarationMaxime Coste
The need to have the array size in the return type was redundant with the actual list of elements.
2017-06-25Remember count when repeating last insertMaxime Coste
Fixes #1465
2017-04-12Place hardware terminal cursor at the current main cursor/prompt cursor positionMaxime Coste
Fixes #1318 Also fixes https://gitlab.com/gnachman/iterm2/issues/5408
2017-03-15Migrate WithBitOps template specialization to with_bit_ops functionMaxime Coste
This way we dont depend on knowing the base template to enable bit ops on an enum type.
2017-03-15Migrate to a more value based meta programming modelMaxime Coste
Introduce Meta::Type<T> to store a type as value, and pass it around, migrate enum_desc and option_type_name to this.
2016-11-28Add more memory domains to certain dataMaxime Coste
2016-11-02Propagate NormalParams to user mappingsMaxime Coste
Closes #896
2016-10-24Make o/O open multiple lines when a count is givenMaxime Coste
Fixes #873
2016-08-22Only drop blank prefixed history entries in command/shell promptsMaxime Coste
For regex prompts we actually want to save them, as a leading space is significant Fixes #767
2016-07-28Use the same logic for mouse wheel and (half) page up/downMaxime Coste
Fixes #749
2016-04-19Add a -password switch to :prompt to allow for more secure password enteringMaxime Coste
Fixes #660
2016-04-13Fix support for macro being recorded and replay during :exec (non draft)Maxime Coste
2016-03-22User mappings and :exec are always executed in normal modeMaxime Coste
Fix #551
2016-02-27Remove direct access to ui, go through clientMaxime Coste
Client can now update menu/info positions when the window move around.
2015-12-12Fix input mode keep alive handling, use a refcount for input modesMaxime Coste
Fixes #528
2015-11-26Remind user hooks disable when replaying last insertMaxime Coste
Fixes #495
2015-11-20Move enum option handling in enum.hh and refactor enum optionsMaxime Coste
2015-11-18Change autoinfo option to be a flags option, document flags optionsMaxime Coste
Support the value1|value2|value3 syntax for flag options.
2015-10-05Use DisplayLine for menu choicesMaxime Coste