aboutsummaryrefslogtreecommitdiff
path: root/helix-view/src/editor.rs
Commit message (Collapse)AuthorAge
* Split modification indicator from file statusline elements (#4731)Colton Clemmer2023-02-10
|
* provide option to completely disable lspSkyler Hawthorne2023-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>
* 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>
* Parse gutter-types as Strings (#5696)Rino2023-01-26
| | | | | | | | This is necessary for configurations like: [editor] gutters = ["diagnostics", "line-numbers"] after the toml 0.6.0 dependency update.
* Make clippy happy on Windows (#5644)Jonathan LEI2023-01-23
|
* Add configuration for min width of line-numbers gutter (#4724)Doug Kelkhoff2023-01-21
|
* Remove apply_transaction helper (#5598)Ivan Tham2023-01-21
|
* Add command to rotate view backward (#5356)mejo132023-01-17
|
* Add some function documentations (#5360)Pascal Sommer2023-01-11
|
* Add a status line element that shows just the basename of the file (#5318)Nick2022-12-31
|
* 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).
* 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>
* Sync all document changes on view focusMichael Davis2022-11-29
|
* Sync changes between doc and view on switchMichael Davis2022-11-29
|
* Remove selections for closed views on all documents (#4888)Michael Davis2022-11-26
| | | | | Previously we removed selections for a closed view on only the currently focused document. A view might have selections in other documents though, so the view needs to be removed from all documents.
* Factor out common code for focusing the next view (#4607)Michael Davis2022-11-17
| | | | | There is some common code between Editor::focus_next and Editor::focus that can be eliminated by refactoring Tree::focus_next into a function that only returns the next ViewId.
* Add global error/warning count statusline element (#4569)Gaurav Tyagi2022-11-15
|
* Statusline indicator to show number of selected chars (#4682)wes adams2022-11-12
| | | Co-authored-by: wes adams <wadams@grayshift.com>
* Dynamically resize line number gutter width (#3469)Doug Kelkhoff2022-11-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | * dynamically resize line number gutter width * removing digits lower-bound, permitting spacer * removing max line num char limit; adding notes; qualified successors; notes * updating tests to use new line number width when testing views * linenr width based on document line count * using min width of 2 so line numbers relative is useful * lint rolling; removing unnecessary type parameter lifetime * merge change resolution * reformat code * rename row_styler to style; add int_log resource * adding spacer to gutters default; updating book config entry * adding view.inner_height(), swap for loop for iterator * reverting change of current! to view! now that doc is not needed
* Resolve a bunch of upcoming clippy lintsBlaž Hrastnik2022-11-04
|
* Fix panic from two windows editing the same document (#4570)Michael Davis2022-11-03
| | | | | | | | | | | | | | | | | | | | * Clamp highlighting range to be within document This fixes a panic possible when two vsplits of the same document exist and enough lines are deleted from the document so that one of the windows focuses past the end of the document. * Ensure cursor is in view on window change If two windows are editing the same document, one may delete enough of the document so that the other window is pointing at a blank page (past the document end). In this change we ensure that the cursor is within view whenever we switch to a new window (for example with `<C-w>w`). * Update helix-term/src/ui/editor.rs Co-authored-by: Blaž Hrastnik <blaz@mxxn.io> Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
* Use OSC 52 as a fallback for setting the system clipboard (#3220)Charlie Groves2022-11-02
| | | | | This adds a simple base64 implementation to keep us from adding a crate for one function. It's mostly based on https://github.com/marshallpierce/rust-base64/blob/a675443d327e175f735a37f574de803d6a332591/src/engine/naive.rs#L42
* 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>
* feat(view): re-use align_view function (#4390)Matouš Dzivjak2022-10-20
|
* reduce LSP timeout to 3sSkyler Hawthorne2022-10-19
|
* fail if doc save sender is closedSkyler Hawthorne2022-10-19
|
* Editor::flush_writes returns an errorSkyler Hawthorne2022-10-19
|
* Wire up save_queue as a part of new_document rather than openBlaž Hrastnik2022-10-19
|
* Use a write_count to determine how many writes left to flushBlaž Hrastnik2022-10-19
|
* Deduplicate flush_writesBlaž Hrastnik2022-10-19
|
* Use a single save_queue on the editorBlaž Hrastnik2022-10-19
|
* Rename doc save event names to past tenseSkyler Hawthorne2022-10-19
|
* increase LSP shutdown timeoutSkyler Hawthorne2022-10-19
| | | | The Clang LAP takes a long time to shut down on Windows
* improve reliability of shutdownSkyler Hawthorne2022-10-19
|
* fix buffer-closeSkyler Hawthorne2022-10-19
|
* fix: buffer-close ensuring writesSkyler Hawthorne2022-10-19
| | | | Make sure buffer-close waits for the document to finish its writes.
* 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.
* Make skip_levels a u8A-Walrus2022-10-17
|
* Fix rendering of lines longer than 2^16A-Walrus2022-10-17
| | | | | Before things would be cast to u16 earlier than needed, which would cause problems for insanely long lines (longer than 2^16 ~ 65 thousand)
* Add cursorcolumn (#4084)A-Walrus2022-10-08
| | | | | | | | | | | | | | | * Implement cursorcolumn * Add documentation * Separate column style from line with fallback * Fallback to cursorcolumn first * Switch to non-fallback try_get_exact Add new function `try_get_exact`, which doesn't perform fallback, and use that instead because the fallback behaviour is being handled manually.
* 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`).
* Change focus to modified docs on quit (#3872)A-Walrus2022-10-03
| | | | | | | | | | | | | | | | | | * Change focus to modified docs on quit When quitting with modified documents, automatically switch focus to one of them. * Update helix-term/src/commands/typed.rs Co-authored-by: Poliorcetics <poliorcetics@users.noreply.github.com> * Make it work with buffer-close-all and the like * Cleanup Use Cow instead of String, and rename DoesntExist -> DoesNotExist Co-authored-by: Poliorcetics <poliorcetics@users.noreply.github.com>
* Add option to skip the first indent guide (#3819)Robin2022-10-03
| | | | | | | | | | | | | | | | | | | | | | | * Add option to skip the first indent guide * reorder skip_first option * change indent-guides.skip_first to a number * rename skip -> skip_levels * add skip_levels to the book * Update book/src/configuration.md Co-authored-by: A-Walrus <58790821+A-Walrus@users.noreply.github.com> * Update helix-term/src/ui/editor.rs Co-authored-by: Michael Davis <mcarsondavis@gmail.com> Co-authored-by: Robin <robinvandijk@klippa.com> Co-authored-by: A-Walrus <58790821+A-Walrus@users.noreply.github.com> Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
* Find workspace from document path (#3553)ath32022-10-03
|
* feat(statusline): add option to show total line numbers in file (#3960)Joshua Pauline2022-10-03
| | | | | * feat(statusline): add option to show total line numbers in file * feat(line numbers): add config to doc book
* Add configureable statusline mode names (#3311)PeepNSheep2022-10-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Added 'long-mode' statusline element * Added customizable statusline mode names * Removed a string clone * Added documentation * Updated documentation, moved modenames to a seperate section * Update configuration.md * Documentation update * Documentation update * Documentation update * Update configuration.md * Update configuration.md * Fixed merge error * Update configuration.md * Update configuration.md
* Add goto preview (#2982)Joe2022-10-03
|
* Remove LspNotDefined, instead return an Option<>Blaž Hrastnik2022-09-07
|
* Expand doc/view macros to allow fetching specific idBlaž Hrastnik2022-09-03
| | | | This simplifies the code and hides away unwraps