aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/commands.rs
Commit message (Collapse)AuthorAge
* fix: write-all crash (#4384)Skyler Hawthorne2022-10-21
| | | | | | | | | | | | | | | | When we do auto formatting, the code that takes the LSP's response and applies the changes to the document are just getting the currently focused view and giving that to the function, basically always assuming that the document that we're applying the change to is in focus, and not in a background view. This is usually fine for a single view, even if it's a buffer in the background, because it's still the same view and the selection will get updated accordingly for when you switch back to it. But it's obviously a problem for when there are multiple views, because if you don't have the target document in focus, it will ask the document to update the wrong view, hence the crash. The problem with this is picking which view to apply any selection change to. In the absence of any more data points on the views themselves, we simply pick the first view associated with the document we are saving.
* Fix unexpected behavior in delete_word_backward and delete_word_forward (#4392)Nimrod2022-10-21
|
* chore(view): remove indent_unit helper fn (#4389)Matouš Dzivjak2022-10-20
|
* fix(commands): no last picker error (#4387)Matouš Dzivjak2022-10-20
|
* Use a single save_queue on the editorBlaž Hrastnik2022-10-19
|
* document should save even if formatter failsSkyler Hawthorne2022-10-19
|
* move language server refresh to document saved event handlerSkyler Hawthorne2022-10-19
|
* fix write-quit with auto formatSkyler Hawthorne2022-10-19
| | | | | write-quit will now save all files successfully even when there is auto formatting
* fix modified status with auto formatSkyler Hawthorne2022-10-19
|
* add conditional noop render backSkyler Hawthorne2022-10-19
| | | | It makes it much slower without stubbing this out
* chore(write): serialize write operations within a DocumentSkyler Hawthorne2022-10-19
| | | | | | | | | | | | | | | The way that document writes are handled are by submitting them to the async job pool, which are all executed opportunistically out of order. It was discovered that this can lead to write inconsistencies when there are multiple writes to the same file in quick succession. This seeks to fix this problem by removing document writes from the general pool of jobs and into its own specialized event. Now when a user submits a write with one of the write commands, a request is simply queued up in a new mpsc channel that each Document makes to handle its own writes. This way, if multiple writes are submitted on the same document, they are executed in order, while still allowing concurrent writes for different documents.
* Fix deleting word from end of buffer (#4328)Jonathan LEI2022-10-19
|
* Use the same `WalkBuilder` configuration for the global search file picker ↵Philipp Mildenberger2022-10-18
| | | | | as the default file picker (#4334) Skip searching .git in global search, similar to how file picker skips listing files in .git.
* Changed Selection Yank Message (#4275)Nathaniel Graham2022-10-14
| | | Co-authored-by: Nathaniel Graham <ngraham@protonmail.com>
* Apply transactions to the jumplist for undo/redo (#4227)Michael Davis2022-10-12
| | | | | Undo/redo/earlier/later call `Document::apply_impl` which applies transactions to the document. These transactions also need to be applied to the view as in 0aedef0.
* Fix some commands not showing names in palette (#4223)Armin Ronacher2022-10-12
|
* Fix append cursor location when selection anchor is at end of document (#4147)Graic2022-10-12
|
* fix: remove unneeded allocations when calling helix_view::Info::newAlexis (Poliorcetics) Bourget2022-10-11
|
* Add a helper function for applying transactionsMichael Davis2022-10-11
| | | | | | It is easy to forget to call `Document::apply` and/or `View::apply` in the correct order. This commit introduces a helper function which closes over both calls.
* Apply transactions to ViewsMichael Davis2022-10-11
| | | | | | This change adds View::apply calls for all Document::apply call-sites, ensuring that changes to a document do not leave invalid entries in the View's jumplist.
* Fix bugs in search wraparound message (#4101)A-Walrus2022-10-04
|
* Automatically track pseudo-pending text (#4077)Michael Davis2022-10-03
| | | | | | | | | | | | | | | | | | This change automatically tracks pending text for for commands which use on-next-key callbacks. For example, `t` will await the next key event and "t" will be shown in the bottom right-hand corner to show that we're in a pending state. Previously, the text for these on-next-key commands needed to be hard-coded into the command definition which had some drawbacks: * It was easy to forget to write and clear the pending text. * If a command was remapped in a custom config, the pending text would still show the old key. With this change, pending text is automatically tracked based on the key events that lead to the command being executed. This works even when the command is remapped in config and when the on-next-key callback is nested under some key sequence (for example `mi`).
* Rename I/A "Insert at start/end of line" (#3753)Michael Davis2022-10-03
| | | | | | | | | | | * keymap: Rename A "Insert at end of line" The language for the `A` binding is potentially confusing because `A` behaves like `i` done at the end of the line rather than `a`. This change renames the command to match Kakoune's language[^1]. [^1]: https://github.com/mawww/kakoune/blob/021da117cf90bf25b65e3344fa8e43ab4262b714/src/normal.cc#L2229 * keymap: Rename I `insert_at_line_start`
* Select inserted space after join (#3549)Ivan Tham2022-10-03
| | | | | | | | | * Select inserted space after join * Split join_selections with space selection to A-J Kakoune does that too and some users may still want to retain their selections. * Update join_selections docs
* Add command names to command palette (#4071)nuid322022-10-03
|
* goto_window_* extends selection (#3985)greg-enbala2022-10-03
| | | | | * goto_window_* extends selection * Don't push to the jumplist
* Extend textobject selections in select modeMichael Davis2022-10-03
|
* Use Range::with_direction consistentlyMichael Davis2022-10-03
|
* Use requested direction for new textobject selection rangeMichael Davis2022-10-03
| | | | | | | | | | | | | | | | | | This changes the behavior of operations like `]f`/`[f` to set the direction of the new range to the direction of the action. The original behavior was to always use the head of the next function. This is inconsistent with the behavior of goto_next_paragraph and makes it impossible to create extend variants of the textobject motions. This causes a behavior change when there are nested functions. The behavior in the parent commit is that repeated uses of `]f` will select every function in the file even if nested. With this commit, functions are skipped. It's notable that it's possible to emulate the original behavior by using the `ensure_selections_forward` (A-:) command between invocations of `]f`.
* Cycled to end/beginning + no more matches msgs (#3176)A-Walrus2022-10-03
| | | | | | | | | * Show status msg when next/prev cycles around * Add msg when there is no wraparound * Cleanup code * Change msg to "Wrapped around document"
* Add pseudo_pending for t/T/f/F (#4062)Matt Freitas-Stavola2022-10-02
|
* Ensure cursor in view after format (#4047)zensayyy2022-10-01
| | | Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
* Split helix_core::find_root and helix_loader::find_local_config_dirs (#3929)Riccardo Binetti2022-09-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Split helix_core::find_root and helix_loader::find_local_config_dirs The documentation of find_root described the following priority for detecting a project root: - Top-most folder containing a root marker in current git repository - Git repository root if no marker detected - Top-most folder containing a root marker if not git repository detected - Current working directory as fallback The commit contained in https://github.com/helix-editor/helix/pull/1249 extracted and changed the implementation of find_root in find_root_impl, actually reversing its result order (since that is the order that made sense for the local configuration merge, from innermost to outermost ancestors). Since the two uses of find_root_impl have different requirements (and it's not a matter of reversing the order of results since, e.g., the top repository dir should be used by find_root only if there's not marker in other dirs), this PR splits the two implementations in two different specialized functions. In doing so, find_root_impl is removed and the implementation is moved back in find_root, moving it closer to the documented behaviour thus making it easier to verify it's actually correct * helix-core: remove Option from find_root return type It always returns some result, so Option is not needed
* Deduplicate regexes in search_selection command (#3941)A-Walrus2022-09-22
|
* fix: View needs to retain the original scroll offset on splitBlaž Hrastnik2022-09-05
|
* Fix off-by-one in extend_line_above (#3689)Michael Davis2022-09-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | `extend_line_above` (and `extend_line` when facing backwards) skip a line when the current range does not fully cover a line. Before this change: foo b#[|a]#r baz With `extend_line_above` or `extend_line` selected the line above. #[|foo bar]# baz Which is inconsistent with `extend_line_below`. This commit changes the behavior to select the current line when it is not already selected. foo #[|bar]# baz Then further calls of `extend_line_above` extend the selection up line-wise.
* Make mode editor-wide rather than per-documentBlaž Hrastnik2022-09-01
|
* fix: prevents storing last prompt if is top of stack (#3609)Saber Haj Rabiee2022-09-01
|
* Refactor goto_ts_object_impl as a motion (#3264)Michael Davis2022-08-31
| | | | | | | | | This refactor changes the overall structure of the goto_ts_object_impl command without removing any functionality from its behavior. The refactored motion: * acts on all selections instead of reducing to one selection * may be repeated with the `repeat_last_motion` (A-.) command * informs the user when the syntax-tree is not accessible in the current buffer
* jumplist: Add documents to view history (#3593)Michael Davis2022-08-31
| | | | | | | | | | | | | | This change adds documents to the view's document history Vec. (This is used by `ga` for example to access the last buffer.) Previously, a sequence like so would have confusing behavior: 1. Open file A: any document with an active language server 2. Find some definition that lives in another file - file B - with `gd` 3. Jump back in the jumplist with `C-o` to file A 4. Use `ga` intending to switch back to file B The behavior prior to this change was that `ga` would switch to file A: you could not use `ga` to switch to file B.
* Fix process spawning error handling (#3349)PiergiorgioZagaria2022-08-30
| | | | | * Fix process spawning error handling * Log stderr in any case
* let extend-line respect range direction (#3046)Bob2022-08-29
| | | | | | | | | | | | | * let extend-line respect range direction * fix extend above logic * keep `x` existing binding * Update book/src/keymap.md Co-authored-by: Ivan Tham <pickfire@riseup.net> Co-authored-by: Ivan Tham <pickfire@riseup.net>
* Add bracketed paste (#3233)Charlie Groves2022-08-29
|
* Editor: remove duplication for view focus/swap commandsBlaž Hrastnik2022-08-23
|
* style: fixes `unused_parens` warnings on nightly builds (#3471)Saber Haj Rabiee2022-08-18
|
* Adjust `m` textobject description and minor code clarification (#3343)Daniel S Poulin2022-08-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * Update description of `m` textobject to its actual functionality Sometime recently the functionality of `m` was changed to match the nearest pair to the cursor, rather than the former functionality of matching the pair only if the cursor was on one of the brace characters directly. * Rename surround methods to reflect that they work on pairs The current naming suggests that they may work generally on any textobject, whereas their implementation really focuses on pairs. * Change description of m textobject to match actual functionality The current implementation of `m` no longer merely looks at the pair character the cursor is on, but actually will search for the pair (defined in helix-core/src/surround.rs) that encloses the cursor, and not the entire selection. * Accept suggested wording change Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Prefix pair surround for consistency Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
* Fix conditional setting of stdin handle on Windows (#3379)Kyle L. Davis2022-08-12
| | | | | | | | | * Revert 3121353c6ab2fbc5fced28f075c7fc45b53b661e * Switch to conditional compilation * Run formatter * Switch from conditional compilation to compile-time bool
* Add custom event type replacing crossterm's Event (#3169)Gokul Soumya2022-08-09
| | | | | | | | | | Ported over from 61365dfbf3 in the `gui` branch. This will allow adding our own events, most notably an idle timer event (useful for adding debounced input in [dynamic pickers][1] used by interactive global search and workspace symbols). [1]: https://github.com/helix-editor/helix/pull/3110 Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
* Avoid setting stdin handle when not necessary (#3248)Dario Oddenino2022-08-05
| | | | | | | | | | | | | | * Avoid setting stdin handle when not necessary Avoid setting the stdin handle in `shell_impl` when the input argument is None. This permits to run commands with no stdin with :sh * refactoring to avoid code duplication * making clippy happy * Process variable name fix
* Avoid copying fragments (#3136)Matthias Deiml2022-08-04
| | | | | | | * Avoid copying fragments * Add slice / slices method * Better documentation for fragment and slice methods