aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/commands.rs
Commit message (Collapse)AuthorAge
* always commit to history when pasting (#5790)Pascal Kuthe2023-02-02
|
* add picker: current view dir (#4666)Filipe Azevedo2023-02-02
|
* Tabulate buffer picker contents (#5777)Gokul Soumya2023-02-02
|
* Hide duplicate symlinks from the picker (#5658)Pascal Kuthe2023-02-02
| | | | | | | | | | | | | | | | * hide duplicate symlinks from the picker * Apply suggestions from code review Co-authored-by: g-re-g <123515925+g-re-g@users.noreply.github.com> * minor stylistic fix Co-authored-by: Michael Davis <mcarsondavis@gmail.com> --------- Co-authored-by: g-re-g <123515925+g-re-g@users.noreply.github.com> Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
* Surround with line-endings on `ms<ret>` (#4571)Michael Davis2023-02-01
| | | | | This change makes `ms<ret>` work similarly to `t<ret>` and related find commands: when the next event is a keypress of Enter, surround the selection with the document's line-endings.
* rework positioning/rendering and enable softwrap/virtual text (#5420)Pascal Kuthe2023-01-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * rework positioning/rendering, enables softwrap/virtual text This commit is a large rework of the core text positioning and rendering code in helix to remove the assumption that on-screen columns/lines correspond to text columns/lines. A generic `DocFormatter` is introduced that positions graphemes on and is used both for rendering and for movements/scrolling. Both virtual text support (inline, grapheme overlay and multi-line) and a capable softwrap implementation is included. fix picker highlight cleanup doc formatter, use word bondaries for wrapping make visual vertical movement a seperate commnad estimate line gutter width to improve performance cache cursor position cleanup and optimize doc formatter cleanup documentation fix typos Co-authored-by: Daniel Hines <d4hines@gmail.com> update documentation fix panic in last_visual_line funciton improve soft-wrap documentation add extend_visual_line_up/down commands fix non-visual vertical movement streamline virtual text highlighting, add softwrap indicator fix cursor position if softwrap is disabled improve documentation of text_annotations module avoid crashes if view anchor is out of bounds fix: consider horizontal offset when traslation char_idx -> vpos improve default configuration fix: mixed up horizontal and vertical offset reset view position after config reload apply suggestions from review disabled softwrap for very small screens to avoid endless spin fix wrap_indicator setting fix bar cursor disappearring on the EOF character add keybinding for linewise vertical movement fix: inconsistent gutter highlights improve virtual text API make scope idx lookup more ergonomic allow overlapping overlays correctly track char_pos for virtual text adjust configuration deprecate old position fucntions fix infinite loop in highlight lookup fix gutter style fix formatting document max-line-width interaction with softwrap change wrap-indicator example to use empty string fix: rare panic when view is in invalid state (bis) * Apply suggestions from code review Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * improve documentation for positoning functions * simplify tests * fix documentation of Grapheme::width * Apply suggestions from code review Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * add explicit drop invocation * Add explicit MoveFn type alias * add docuntation to Editor::cursor_cache * fix a few typos * explain use of allow(deprecated) * make gj and gk extend in select mode * remove unneded debug and TODO * mark tab_width_at #[inline] * add fast-path to move_vertically_visual in case softwrap is disabled * rename first_line to first_visual_line * simplify duplicate if/else --------- Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
* Support goto-declaration LSP command (#5646)Ole Krüger2023-01-31
|
* keymap: Test backslash escaping in commandsds-cbo2023-01-25
|
* Fix selecting a changed file in global search (#5639)Pascal Kuthe2023-01-23
|
* Remove apply_transaction helper (#5598)Ivan Tham2023-01-21
|
* Fix panic for noop selecting join (#5579)Pascal Kuthe2023-01-18
|
* Replace menu::Item::{row, label} with format()Gokul Soumya2023-01-18
|
* Add command to rotate view backward (#5356)mejo132023-01-17
|
* Commit to history after executing a command from the palette (#5294)Nikodem Rabuliński2023-01-16
|
* Separate jump behavior from increment/decrement (#4123)greg-enbala2023-01-16
| | | | | | | | | | | | | | increment/decrement (C-a/C-x) had some buggy behavior where selections could be offset incorrectly or the editor could panic with some edits that changed the number of characters in a number or date. These stemmed from the automatic jumping behavior which attempted to find the next date or integer to increment. The jumping behavior also complicated the code quite a bit and made the behavior somewhat difficult to predict when using many cursors. This change removes the automatic jumping behavior and only increments or decrements when the full text in a range of a selection is a number or date. This simplifies the code and fixes the panics and buggy behaviors from changing the number of characters.
* fix(commands): extend_line to proper line when count and current line ↵Gabriel Dinner-David2022-12-31
| | | | selected (#5288)
* Fix erroneous indent between closers of auto-pairs (#5330)Triton1712022-12-29
| | | inserting a newline between 2 closers of an auto-pair.
* Add command to merge consecutive ranges in selection (#5047)DylanBulfin2022-12-23
|
* Restore deleted goto_pos function (#5164)Sebastian Zivota2022-12-15
|
* Select diagnostic range in goto_*_diag commands (#4713)Michael Davis2022-12-15
| | | | | This roughly matches the behavior of the diagnostic picker: when jumping to a diagnostic with `[d`/`]d`/`[D`/`]D`, the range of the diagnostic is selected instead of the start point.
* Reset mode when changing buffers (#5072)Michael Davis2022-12-11
| | | | | | | | | | | | | | * Reset mode when changing buffers This is similar to the change in e4c9d4082a139aac3aea4506918171b96e81f5b9: reset the editor to normal mode when changing buffers. Usually the editor is already in normal mode but it's possible to setup insert-mode keybindings that change buffers. * Move normal mode entering code to Editor This should be called internally in the Editor when changing documents (Editor::switch) or changing focuses (Editor::focus).
* Fix LSP completions ignoring auto-completion option (#5042)Jummit2022-12-09
|
* Add command/keybinding to jump between hunks (#4650)Pascal Kuthe2022-12-06
| | | | | | | | | | | | | | | * add command and keybding to jump to next/prev hunk * add textobject for change * Update helix-vcs/src/diff.rs Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * select entire hunk instead of first char * fix selection range Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
* fix: align view after jumplist_picker (#3743)Narazaki Shuji2022-12-06
| | | | | | | | | * Add `View::ensure_cursor_in_view_center` to adjust view after searching and jumping Also `offset_coodrs_to_in_view` was refactored to reduce duplicated position calculations. * Fix a wrong offset calculation in `offset_coords_to_in_view_center` It ignored `scrolloff` if `centering` is false.
* Change default TS object bindings (#3782)nosa2022-12-06
| | | | | | | | | | | | | | * Change default TS object bindings Changes 'match inside/around' bindings for: - type definition from `c` to `t` - comments from `o` to `c` - tests from `t` to `T` Also changes those for the `]` / `[` bindings. * Update docs for changed keybinds Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
* Fix nightly clippy lints (#4954)Tshepang Mbambo2022-12-01
|
* Call View::apply within Document::append_changes_to_historyMichael Davis2022-11-29
|
* Revert "Don't apply transactions to Views in undo/redo"Michael Davis2022-11-29
| | | | This reverts commit fd00f3a70eb626242bb2fcc9bddf2c4d94580a9a.
* Clear line on `<ret>` when line is all whitespace (#4854)Michael Davis2022-11-25
| | | | | | This matches the insert-mode behavior for Vim and Kakoune: if the current line is empty except for whitespace, `<ret>` should insert a line ending at the beginning of the line, moving any indentation to the next line.
* Exit select mode on surround commands (#4858)Jonathan LEI2022-11-24
|
* Don't apply transactions to Views in undo/redoMichael Davis2022-11-24
| | | | | | View::apply should only be called by EditorView after 42e37a571e75aaf4feb1717dfebe8cf215e535dd. This change removes the duplicate calls within undo/redo which could cause a panic.
* lsp: Check server provider capabilities (#3554)Michael Davis2022-11-22
| | | | | | | | | | | | | | Language Servers may signal that they do not support a method in the initialization result (server capabilities). We can check these when making LSP requests and hint in the status line when a method is not supported by the server. This can also prevent crashes in servers which assume that clients do not send requests for methods which are disabled in the server capabilities. There is an existing pattern the LSP client module where a method returns `Option<impl Future<Output = Result<_>>>` with `None` signaling no support in the server. This change extends this pattern to the rest of the client functions. And we log an error to the statusline for manually triggered LSP calls which return `None`.
* remove duplicated shell calls (#3465)Bob2022-11-22
|
* Limit the number of items in the jumplist (#4750)Michael Davis2022-11-22
| | | | | | | | | | | | | | | | | | | | | Previously, jumplists could grow unchecked. Every transaction is applied to jumplist selections to ensure that they are up to date and within document bounds, so this would cause every edit to become more expensive as jumplist lengths increased throughout a session. Setting a maximum number of entries limits the cost. Vim and Neovim limit their jumplists: * https://github.com/vim/vim/blob/b298fe6cbae3b240b10dbd55d9c38d0cc8e033d3/src/structs.h#L141 * https://github.com/neovim/neovim/blob/e8cc489accc435076afb4fdf89778b64f0a48473/src/nvim/mark_defs.h#L57 Notably, Kakoune does not. In Kakoune, changes are applied to jumplist entries lazily as you hit `<C-o>`/`<C-i>` though, so Kakoune doesn't have the same growing cost concerns. Kakoune also does not have a concept of a View which limits the cost further. Vim and Neovim limit to 100. This seems unreasonably high to me so I've set this to 30 to start. We can increase if this is problematically low.
* Select new pasted text in normal mode only (#4824)Michael Davis2022-11-21
| | | | | | | | | | | | | | | | | | d6323b7cbc21a9d3ba29738c76581dad93f9f415 changed the behavior of paste to select the newly inserted text. This is preferrable in normal mode because it's useful to be able to act on the new text. This behavior is worse for insert or select mode though: * In insert mode, the cursor ends up on the last character of the newly selected text, so further typing inserts text before the last character. * In select mode, the current selection is replaced with the new text selection which doesn't extend the current selection. With this change, the selection is extended to include the new text. This aligns the behavior more closely with Kakoune, but it's coincidental instead of intentional: Kakoune doesn't implement bracketed paste (AFAIK) which causes this behavior in insert mode, and Kakoune doesn't have a select mode.
* Add preview for scratch buffers in buffer picker (#3454)A-Walrus2022-11-21
|
* Make `r<tab>` and `f<tab>` work (#4817)Lennard Hofmann2022-11-19
| | | | | Previously, commands such as `r<tab>` (replace with tab) or `t<tab>` (select till tab) had no effect. This is because `KeyCode::Tab` needs special treatment (like `KeyCode::Enter`).
* Select surrounding characters when using match/surround (m) mode (#4752)Austen Adler2022-11-18
| | | Co-authored-by: Austen Adler <agadler@austenadler.com>
* Remove prefix filtering from autocomplete menu (#4578)ChrHorn2022-11-17
| | | | | | | | | PR #4134 switched the autocomplete menu from alphabetical to fuzzy sorting. This commit removes the still existing filtering by prefix and should enable full fuzzy sorting of the autocomplete menu. closes #3084, #1807 Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
* Use key-sequence format for command palette keybinds (#4712)Michael Davis2022-11-17
| | | | | The text within the command palette used a custom format to display the keybinding for a command. This change switches to the key sequence format that we use for pending keys and macros.
* minor: Simplify some command codeBlaž Hrastnik2022-11-16
|
* minor: cloning filter and using count() is wasteful hereBlaž Hrastnik2022-11-16
|
* fix buildBlaž Hrastnik2022-11-15
|
* Add command to add word boundaries to search (#4322)Armin Ronacher2022-11-15
| | | | | * Add command to add word boundaries to search * Calculate string capacity before building
* Refactor blackhole register (#4504)ath32022-11-15
|
* Fix range offsets for multiple shell insertions (#4619)Michael Davis2022-11-14
| | | | | | | | | | | | | d6323b7cbc21a9d3ba29738c76581dad93f9f415 introduced a regression for shell commands like `|`, `!`, and `<A-!>` which caused the new selections to be incorrect. This caused a panic when piping (`|`) would cause the new range to extend past the document end. The paste version of this bug was fixed in 48a3965ab43718ce2a49724cbcc294b04c328b81. This change also inherits the direction of the new range from the old range and adds integration tests to ensure that the behavior isn't broken in the future.
* rename description for `goto_line_end_newline`asvln2022-11-12
|
* add `extend_prev_word_end` commandasvln2022-11-12
|
* feat(commands): increment by range (#4418)Bruce Hopkins2022-11-11
|
* Re-enable format_selections for a single selection rangeBlaž Hrastnik2022-11-09
|