aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/commands/typed.rs
Commit message (Collapse)AuthorAge
* Softwrapping improvements (#5893)Clément Delafargue2023-03-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * use max_line_width + 1 during softwrap to account for newline char Helix softwrap implementation always wraps lines so that the newline character doesn't get cut off so he line wraps one chars earlier then in other editors. This is necessary, because newline chars are always selecatble in helix and must never be hidden. However That means that `max_line_width` currently wraps one char earlier than expected. The typical definition of line width does not include the newline character and other helix commands like `:reflow` also don't count the newline character here. This commit makes softwrap use `max_line_width + 1` instead of `max_line_width` to correct the impedance missmatch. * fix typos Co-authored-by: Jonathan Lebon <jonathan@jlebon.com> * Add text-width to config.toml * text-width: update setting documentation * rename leftover config item * remove leftover max-line-length occurrences * Make `text-width` optional in editor config When it was only used for `:reflow` it made sense to have a default value set to `80`, but now that soft-wrapping uses this setting, keeping a default set to `80` would make soft-wrapping behave more aggressively. * Allow softwrapping to ignore `text-width` Softwrapping wraps by default to the viewport width or a configured `text-width` (whichever's smaller). In some cases we only want to set `text-width` to use for hard-wrapping and let longer lines flow if they have enough space. This setting allows that. * Revert "Make `text-width` optional in editor config" This reverts commit b247d526d69adf41434b6fd9c4983369c785aa22. * soft-wrap: allow per-language overrides * Update book/src/configuration.md Co-authored-by: Pascal Kuthe <pascal.kuthe@semimod.de> * Update book/src/languages.md Co-authored-by: Pascal Kuthe <pascal.kuthe@semimod.de> * Update book/src/configuration.md Co-authored-by: Pascal Kuthe <pascal.kuthe@semimod.de> --------- Co-authored-by: Pascal Kuthe <pascal.kuthe@semimod.de> Co-authored-by: Jonathan Lebon <jonathan@jlebon.com> Co-authored-by: Alex Boehm <alexb@ozrunways.com> Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
* Do not add intermediate lines to jumplist with :<linenum> command. (#5751)Kyle Smith2023-03-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | * Do not add intermediate lines to jumplist with :<linenum> command. * Revert jumplist index changes. * Reduce calculations during update cycle. * Use jumplist for undo, set jumplist before preview. * remove some debug logging * Revert "remove some debug logging" This reverts commit 5772c4327e7121c53ea0726a4d7333ae1c413ffb. * Revert "Use jumplist for undo, set jumplist before preview." This reverts commit f73a1b29824feaf16477b9df547fb28d9db81923. * Add last_selection, update implementation. * @pascalkuthe initial feedback * Ensure ":goto 123" keybinding works as expected. * fix clippies, prefer expect() for expect last_selection state
* Add command for resetting diff hunks (#5736)Pascal Kuthe2023-03-08
|
* Allow LSP server to be stopped (#5964)Davide Galassi2023-03-08
|
* feat: show current language when no argument is provided (#5895)Guillaume2023-02-16
|
* Add :toggle-option command (#4085)A-Walrus2023-02-13
| | | This command toggles the value of boolean options
* Address new clippy lintsBlaž Hrastnik2023-02-09
|
* Add :character-info command (#4000)William Etheredge2023-02-03
|
* always commit to history when pasting (#5790)Pascal Kuthe2023-02-02
|
* Use filename completer on run-shell-command (#5729)Jonathan LEI2023-01-30
|
* Remove apply_transaction helper (#5598)Ivan Tham2023-01-21
|
* Fix language config reload logic (#5381)Ethan Kiang2023-01-03
|
* Expand `~` when parsing file paths in `:open` (#5329)iobtl2022-12-29
|
* Fix opening new files (#5278)alois312022-12-24
| | | | | | | Commit 1b89d3e5350f83b2ffb86a86326bd2714308ee53 introduced a regression where opening a new file would no longer work, because attempting to canonicalize its path would lead to a "No such file or directory" error. Fall back to opening a new file when encountering an error to fix this case.
* Add file picker dialogue when opening a directory with :o (#2707)Jack Allison2022-12-23
|
* Remove redraw to fix buildBlaž Hrastnik2022-12-15
|
* add redraw command (#4354)Roberto Vidal2022-12-15
| | | | | | | | | | | | | * add redraw command * update docs * Update helix-term/src/commands/typed.rs Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * update docs Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
* Improve error message handling for theme loading failures (#5073)Michael Davis2022-12-15
| | | | | | | | | | | | | | | | | The error messages for a theme that failed to be deserialized (or otherwise failed to load) were covered up by the context/with_context calls: * The log message for a bad theme configured in config.toml would only say "Failed to deserilaize theme" * Selecting a bad theme via :theme would show "Theme does not exist" With these changes, we let the TOML deserializer errors bubble up, so the error messages can now say the line number of a duplicated key - and that key's name - when a theme fails to load because of a duplicated key. Providing a theme which does not exist to :theme still gives a helpful error message: "No such file or directory."
* Add `:pipe-to` typable command that ignores shell output (#4931)Alexander Schlögl2022-12-12
|
* reload_all: Ensure view is synced with doc history before reload (#4965)Michael Davis2022-12-02
|
* Show (git) diff signs in gutter (#3890)Pascal Kuthe2022-12-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Show (git) diff signs in gutter (#3890) Avoid string allocation when git diffing Incrementally diff using changesets refactor diffs to be provider indepndent and improve git implementation remove dependency on zlib-ng switch to asynchronus diffing with similar Update helix-vcs/Cargo.toml fix toml formatting Co-authored-by: Ivan Tham <pickfire@riseup.net> fix typo in documentation use ropey reexpors from helix-core fix crash when creating new file remove useless use if io::Cursor fix spelling mistakes implement suggested improvement to repository loading improve git test isolation remove lefover comments Co-authored-by: univerz <univerz@fu-solution.com> fixed spelling mistake minor cosmetic changes fix: set self.differ to None if decoding the diff_base fails fixup formatting Co-authored-by: Ivan Tham <pickfire@riseup.net> reload diff_base when file is reloaded from disk switch to imara-diff Fixup formatting Co-authored-by: Blaž Hrastnik <blaz@mxxn.io> Redraw buffer whenever a diff is updated. Only store hunks instead of changes for individual lines to easily allow jumping between them Update to latest gitoxide version Change default diff gutter position Only update gutter after timeout * update diff gutter synchronously, with a timeout * Apply suggestions from code review Co-authored-by: Blaž Hrastnik <blaz@mxxn.io> Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * address review comments and ensure lock is always aquired * remove configuration for redraw timeout Co-authored-by: Blaž Hrastnik <blaz@mxxn.io> Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
* 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.
* reload-all: Only update viewport when view focuses on the doc (#4901)Filipe Azevedo2022-11-26
|
* 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.
* Add `:reload-all` command (#4663)Filipe Azevedo2022-11-20
|
* Capture word parts while calculating shellwords (#4632)Michael Davis2022-11-17
| | | | | | | | | | | | | | | | | | | This fixes an edge case for completing shellwords. With a file "a b.txt" in the current directory, the sequence `:open a\<tab>` will result in the prompt containing `:open aa\ b.txt`. This is because the length of the input which is trimmed when replacing with completion is calculated on the part of the input which is parsed by shellwords and then escaped (in a separate operation), which is lossy. In this case it loses the trailing backslash. The fix provided here refactors shellwords to track both the _words_ (shellwords with quotes and escapes resolved) and the _parts_ (chunks of the input which turned into each word, with separating whitespace removed). When calculating how much of the input to delete when replacing with the completion item, we now use the length of the last part. This also allows us to eliminate the duplicate work done in the `ends_with_whitespace` check.
* Add LSP workspace command picker (#3140)Matthias Deiml2022-11-09
| | | | | | | * Add workspace command picker * Make command typable * Add optional argument to lsp-workspace-command
* Fix command-mode completion behavior when input is escapedMichael Davis2022-11-07
| | | | | | | If `a\ b.txt` were a local file, `:o a\ <tab>` would fill the prompt with `:o aa\ b.txt` because the replacement range was calculated using the shellwords-parsed part. Escaping the part before calculating its length fixes this edge-case.
* Escape filenames in command completionMichael Davis2022-11-07
| | | | | | This changes the completion items to be rendered with shellword escaping, so a file `a b.txt` is rendered as `a\ b.txt` which matches how it should be inputted.
* Fix whitespace handling in command-mode completionMichael Davis2022-11-07
| | | | | | | | | | 8584b38cfbe6ffe3e5d539ad953c413e44e90bfa switched to shellwords for completion in command-mode. This changes the conditions for choosing whether to complete the command or use the command's completer. This change processes the input as shellwords up-front and uses shellword logic about whitespace to determine whether the command or argument should be completed.
* Correctly handle escaping in completion (#4316)Armin Ronacher2022-11-01
| | | | | * Correctly handle escaping in completion * Added escaping tests
* commands: Make no arg ':theme' show name (#3740)James O. D. Hunt2022-10-26
| | | | | | | | | | | | | | | | Most commands that accept an argument show their current value if no argument is specified. The `:theme` command previously displayed an error message in the status bar if not provided with an argument: ``` Theme name not provided ``` It now shows the current theme name in the status bar if no argument is specified. Signed-off-by: James O. D. Hunt <jamesodhunt@gmail.com> Signed-off-by: James O. D. Hunt <jamesodhunt@gmail.com>
* Add `:update` that will write the changes if the file has been modified. ↵Gaurav Tyagi2022-10-26
| | | | | | | | | (#4426) * add command update that will write the changes if file hasn been modified * add docs * update the docs
* 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.
* flush writes on force quit (#4397)Skyler Hawthorne2022-10-21
| | | | | | When force quitting, we need to block on the pending writes to ensure that write commands succeed before exiting, and also to avoid a crash when all the views are gone before the auto format call returns from the LS.
* Autosave all when the terminal loses focus (#3178)Charlie Groves2022-10-21
| | | | | | | | | | | * Autosave all when the terminal loses focus * Correct comment on focus config Co-authored-by: Blaž Hrastnik <blaz@mxxn.io> * Need a block_try_flush_writes in all quit_all paths Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
* Merge pull request #2267 from dead10ck/fix-write-failBlaž Hrastnik2022-10-20
|\ | | | | Write path fixes
| * fix tree_sitter_scopesSkyler Hawthorne2022-10-19
| |
| * Editor::flush_writes returns an errorSkyler Hawthorne2022-10-19
| |
| * Deduplicate flush_writesBlaž Hrastnik2022-10-19
| |
| * Use a single save_queue on the editorBlaž Hrastnik2022-10-19
| |
| * review commentsSkyler Hawthorne2022-10-19
| |
| * fix write scratch buffer to fileSkyler Hawthorne2022-10-19
| |
| * various fixes in write-all pathSkyler Hawthorne2022-10-19
| |
| * fix panic when view of pending write is closedSkyler 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
| |
| * improve reliability of shutdownSkyler Hawthorne2022-10-19
| |
| * add conditional noop render backSkyler Hawthorne2022-10-19
| | | | | | | | It makes it much slower without stubbing this out