summaryrefslogtreecommitdiff
path: root/src/input_handler.cc
AgeCommit message (Collapse)Author
2021-02-15Add + key to duplicate selections and <a-+> to merge overlapping onesMaxime Coste
This is an experiment and might get reverted if overlapping selections prove too cumbersome. Fixes #4041
2021-01-03Add missing limits includesMaxime Coste
Fixes #4003
2020-12-20Add Timer::disable() to be more explicit than set_next_date(TimePoint::max())Maxime Coste
2020-12-01Avoid potential use after free of the mode nameMaxime Coste
This can be an issue with NextKey that now does not have a static mode name.
2020-12-01Ensure InputModes are kept alive during their idle logicMaxime Coste
Various paths can run arbitrary commands (callbacks, hooks) which could lead to the InputMode being popped off the mode stack, but contrarily to the on_key method, we had no guarantees to be kept alive. Add a keep_alive RefPtr to this to ensure the mode survives till the end. Fixes #3915
2020-11-18Restore auto-select on return, add a flag to disable that for commandsMaxime Coste
Fixes #3849 Again
2020-11-17Revert "Auto-insert prompt menu completions on <ret> if any text was entered"Maxime Coste
Unfortunately this breaks some pretty useful use cases, such as inserting a command ending with a new-line (as it now leads to an addtional command being auto-completed on validation) This reverts commit aab0be529f77f3a8e86185a030838e6d547d0286.
2020-11-01Auto-insert prompt menu completions on <ret> if any text was enteredMaxime Coste
Previously we would only auto-insert if the current token had some text, but this breaks auto-selection of the first match. Fixes #3849
2020-10-20Disable auto-insertion of menu completion when no text was enteredMaxime Coste
This avoids a frustrating behaviour where Kakoune autoinserts the first command name when hitting <space> after a ; in a command line. It also fixes the empty prompt case that was auto-completed instead of executing the default command.
2020-10-19Auto-insert best completion on space for menu completionsMaxime Coste
The menu flag signifies that only the completions are valid arguments, hence it makes sense to auto insert the best one on space. Because full match is always considered the best match in completion ranking, this should always have a reasonable behaviour. This makes it harder to enter a hidden command, but completion can always be disabled via <c-o> or by quoting in those rare cases.
2020-10-19Add support for explicit completion in prompt modeMaxime Coste
2020-07-05Fix selections getting unsorted on scrollMaxime Coste
Fixes #3478
2020-06-28Refactor mouse press/release handling to support 3 buttonsMaxime Coste
Change button to be an additional parameter instead of having separate events for left/right buttons. Fixes #3471
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-16Replace ModeChange hooks by ModePush and ModePopMaxime Coste
Remove deprecated InsertBegin, InsertEnd, NormalBegin, NormalEnd hooks. Closes #2545
2019-09-15Allow scrolling while dragging mouseMaxime Coste
Closes #2052
2019-09-07Fix modifiers support with mouse eventsMaxime Coste
2019-08-19Make scrolling speed configurableMaxime Coste
The UI now can send a 'Scroll' key, whose value is the scrolling amount encoded as a signed integer. This replaces the MouseWheelUp and MouseWheelDown keys. The NCursesUI now has a ncurses_wheel_scroll_amount ui_option that controls that amount, it can be negative to swap scrolling direction. Fixes #3045
2019-07-21Slight code cleanup in prompt history handlingMaxime Coste
2019-07-06fix a few typosJoachim Henke
2019-06-23Use register to store prompt historyMaxime Coste
2019-05-29Do not merge selections on backspace in insert modeMaxime Coste
Fixes #2861
2019-05-17Introduce Menu completion flags to auto select best candidateMaxime Coste
2019-04-28Fix typoAlex Leferry 2
2019-02-27Fixed all reorder warningsJustin Frank
2019-01-24Header and dependency cleanupMaxime Coste
2018-12-20src: Add support for right click eventsFrank LENORMAND
The current implementation treats left mouse button clicks as a generic "mouse press" modifier, this commit extends the list of modifiers by adding a "right mouse click" one. The proper way to implement this would be to ship the coordinates of mouse key press events in each `Key` object, and pass whichever button was clicked as a codepoint value (instead of coordinates currently), but this would require more work. This commit allows: * right clicks to set the cursor of the main selection * control-right clicks to merge all the selections, and then set its cursor Fixes #843
2018-11-25Merge remote-tracking branch 'lenormf/rename-auto_complete'Maxime Coste
2018-10-23Refactor Hook management to have a well defined list of hooksMaxime Coste
Hooks are now an enum class instead of passing strings around.
2018-09-04Add readline word erase bindings, throw in clipboard for good measureMaxime Coste
Add <c-w> and <a-d> (along with <c-W> and <a-D> that work on WORDs), and <c-y> which pastes the transient clipboard contant (which saves big erase, such as word erase and line end/begin erase). Fixes #2355
2018-09-03Change line editing bindings to match readline'sMaxime Coste
In the end, no better solution materialized so far, and custom Kakoune line editing bindings are hard to remember. Using well known readline bindings seems just more convenient. Closes #800, although it does not contain all the binding proposed by it (I might accept a few additional ones, such as <c-w>, but not too much, I still see that as a hack pending a nicer solution).
2018-08-27Add toggling capabilities for <c-o> in Insert and Prompt modeDelapouite
Ref #2121
2018-07-26Cleanup some trailing whitespaces and double semicolonMaxime Coste
2018-07-19src: Rename `auto_complete` to `autocomplete`Frank LENORMAND
Removing the underscore seems to make the option name more in line with the others (even though some do use a separator, e.g. `disabled_hooks`).
2018-07-15Fix manual insert completion menu not getting automatically hiddenMaxime Coste
Fixes #2208
2018-07-15Add support for <a-;> in prompt modeMaxime Coste
Fixes #2096 Closes #2060
2018-07-15Change autoshowcompl to auto_complete with insert|prompt possible valuesMaxime Coste
2018-07-05Change `a` on end of line behaviour to be consistentMaxime Coste
`a` will just jump on next line, `a` on last end of line opens a new line beneath it. Fixes #1164
2018-06-19Fix two <s-tab> requiered to access last completion in promptMaxime Coste
A single <s-tab> should be enough.
2018-06-03Add MenuStyle::Search that prevents the menu from hiding buffer textMaxime Coste
Fixes #2042
2018-05-26Do not expose C++ typeid().name to user facing errors on wrong option typeMaxime Coste
Fixes #2079
2018-05-14Rename Context::Flags::Transient to Context::Flags::DraftMaxime Coste
Draft is well establish and all draft context are transient.
2018-05-03Add support for explicit menu selection from the UIMaxime Coste
the JsonUI now supports a "menu_select(int)" RPC call that should trigger explicit selection of the provided item index. As discussed for issue #2019.
2018-05-02Refactor buffer undo treeMaxime Coste
Store the undo tree as an array of undo nodes, instead of as a pointer based tree.
2018-04-11Add support for the shift modifier.Tim Allen
Because keyboard layouts vary, the shift-modifier `<s-…>` is only supported for special keys (like `<up>` and `<home>`) and for ASCII lowercase where we assume the shift-modifier just produces the matching uppercase character. Even that's not universally true, since in Turkish `i` and `I` are not an uppercase/lowercase pair, but Kakoune's default keyboard mappings already assume en-US mappings for mnemonic purposes. Mappings of the form `<s-x>` are normalized to `<X>` when `x` is an ASCII character. `<backtab>` is removed, since we can now say `<s-tab>`.
2018-04-07Make FaceRegistry scopedMaxime Coste
set-face now takes a scope argument, and faces can be overridden on a buffer or window basis. colorscheme apply on global scope, which should be good enough for now. Fixes #1411
2018-04-06Make error messages more consistentDelapouite