* add basic completion replay
* use transaction as the last completion
* completion replay only on trigger position
* cache changes in CompletionAction
Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
* Show infobox to hint textobjects with `mi` and `ma`
* Add note to infobox than any pair of characters will work too
The wording could probably be a little more clear, but I wanted to
keep it short but still accurate.
* Don't allocate a vec for the static help text
* Fix bug where `mi<esc>` would swallow next input and persist infobox
* Better help text for arbitrary pair matching in textobject selection
* Add way to add fake pending key data below status, use with `mi`/`ma`
This is a bit hacky as it makes use of global state which will end
up managed in multiple places, but has precedent in the way autoinfo
works. There should probably be a bigger refactor to handle this
kind of state better.
* Return early on anything other than `mi` and `ma` for autoinfo
* Remove "ascii" from help text with `mi` and `ma`
* Update helix-term/src/ui/editor.rs
Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
* Add Event::Used to use event callback without consuming
* Close popup if contents ignored event
* collect event results before executing callbacks
* don't add new result variant, use Ignored(..) instead
* break in match cases
* Make auto_close configurable
* fix merge
* auto close hover popups
* fix formatting
* feat(commands): command palette
Add new command to display command pallete that can be used
to discover and execute available commands.
Fixes: https://github.com/helix-editor/helix/issues/559
* Make picker take the whole context, not just editor
* Bind command pallete
* Typable commands also in the palette
* Show key bindings for commands
* Fix tests, small refactor
* Refactor keymap mapping, fix typo
* Ignore sequence key bindings for now
* Apply suggestions
* Fix lint issues in tests
* Fix after rebase
Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
This code:
let start = ensure_grapheme_boundary_next(text, text.byte_to_char(start));
let end = ensure_grapheme_boundary_next(text, text.byte_to_char(end));
Would convert byte to char index, but then internally immediately convert back
to byte index, operate on it, then convert it to char index.
This change reduces the amount of time spent in ensure_grapheme_boundary from
29% to 2%.
* feat(ui): file encoding in statusline
Display file encoding in statusline if the encoding
isn't UTF-8.
* Re-export encoding_rs from core
From there it can be imported by other mods
that rely on it.
* Macros WIP
`helix_term::compositor::Callback` changed to take a `&mut Context` as
a parameter for use by `play_macro`
* Default to `@` register for macros
* Import `KeyEvent`
* Special-case shift-tab -> backtab in `KeyEvent` conversion
* Move key recording to the compositor
* Add comment
* Add persistent display of macro recording status
When macro recording is active, the pending keys display will be shifted
3 characters left, and the register being recorded to will be displayed
between brackets — e.g., `[@]` — right of the pending keys display.
* Fix/add documentation
1. pressing o on a line with no indentation will open a new line as
expected, but esc will then delete the line altogether
2. the kill_line behavior happens after insert mode changes are already
commited to history, and the change isn't commited. pressing u after
this will break highlighting & undo history
This reverts commit c08d2fae58.
Tree sitter returns an index referring to the position of the scope in
the scopes array. We can use that same index to avoid a hashmap lookup
and instead store the styles in an array.
This currently stores the styles in both a map and an array because the
UI still uses hashmap lookups, but it's a reasonable tradeoff.
* restore indent when press esc right after open a new line
* add comment for restore_indent
* fix, and make kill to line end behaves like emacs
* update comment
* fix comment
* adjust cancel restore_indent situation
* check esc logic in mode transaction
* improve comment
* add more check for dedent
* update comment
* use matches to check for last_cmd
* no need to introduct CommandFun type
* Jump to end char of surrounding pair from any cursor pos
* Separate bracket matching into exact and fuzzy search
* Add constants for bracket chars
* Abort early if char under cursor is not a bracket
* Simplify bracket char validation
* Refactor node search and unify find methods
* Remove bracket constants
* Allow keys to be mapped to sequences of commands
* Handle `Sequence` at the start of `Keymap::get`
* Use `"[Multiple commands]"` as command sequence doc
* Add command sequence example to `remapping.md`
* Improve statusline
* Change diagnostic count display to show counts of individual
diagnostic types next to their corresponding gutter dots.
* Add selection count to the statusline.
* Do not display info or hint count in statusline
* Reduce padding
Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
* Reduce padding
Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
* Use `Span::styled`
* Reduce padding
* Use `Style::patch`
* Remove unnecessary `Cow` creation
Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>