aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/ui/editor.rs
Commit message (Collapse)AuthorAge
* Fix nightly clippy lints (#4954)Tshepang Mbambo2022-12-01
|
* 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
|
* Remove eager application of transactions to all viewsMichael Davis2022-11-29
|
* Apply inversions to Views on undo/redoMichael Davis2022-11-24
| | | | | | | | When using undo/redo, the history revision can be decremented. In that case we should apply the inversions since the given revision in History::changes_since. This prevents panics with jumplist operations when a session uses undo/redo to move the jumplist selection outside of the document.
* Apply transactions to all views (#4733)Michael Davis2022-11-23
| | | | | | | | | | | | | | | | | * Add a test case for updating jumplists across windows * Apply transactions to all views on history changes This ensures that jumplist selections follow changes in documents, even when there are multiple views (for example a split where both windows edit the same document). * Leave TODOs for cleaning up View::apply * Use Iterator::reduce to compose history transactions Co-authored-by: Blaž Hrastnik <blaz@mxxn.io> Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
* minor: render_diagnostics doesn't require &self eitherBlaž Hrastnik2022-11-19
|
* Avoid repeatedly loading configBlaž Hrastnik2022-11-19
|
* 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
* 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>
* fix: repeating repeat operator (#4450)Michał Zabielski2022-10-26
|
* lsp: Resolve completion items missing documentation on idle (#4406)Michael Davis2022-10-22
| | | | | | | | Some language servers may not send the `documentation` field if it is expensive to compute. Clients can request the missing field with a completionItem/resolve request. In this change we use the idle-timeout event to ensure that the current completion item is resolved.
* 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>
* remove Callback::Compositor variantSkyler Hawthorne2022-10-19
| | | | To reduce likelihood of accidental discarding of important callbacks
* fix write-quit with auto formatSkyler Hawthorne2022-10-19
| | | | | write-quit will now save all files successfully even when there is auto formatting
* Replace `in_bounds` with calculation of end_indentA-Walrus2022-10-17
| | | | | | Instead of repeatedly checking if it is in_bounds, calculate the max_indent beforehand and just loop. I added a debug_assert to "prove" that it never tries drawing out of bounds.
* Only draw indent guides within boundsA-Walrus2022-10-17
| | | | | | Better performance, and otherwise very long lines with lots of tabs will wrap around the u16 and come back on the other side, messing up the beginning skip_levels.
* 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)
* Fix debug assertion for diagnostic sort order (#4319)Michael Davis2022-10-16
| | | | | | | The debug assertion that document diagnostics are sorted incorrectly panics for cases like `[161..164, 162..162]`. The merging behavior in the following lines that relies on the assertion only needs the input ranges to be sorted by `range.start`, so this change simplifies the assertion to only catch violations of that assumption.
* Overlay all diagnostics with highest severity on top (#4113)Michael Davis2022-10-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Here we separate the diagnostics by severity and then overlay the Vec of spans for each severity on top of the highlights. The error diagnostics end up overlaid on the warning diagnostics, which are overlaid on the hints, overlaid on info, overlaid on any other severity (default), then overlaid on the syntax highlights. This fixes two things: * Error diagnostics are now always visible when overlapped with other diagnostics. * Ghost text is eliminated. * Ghost text was caused by duplicate diagnostics at the EOF: overlaps within the merged `Vec<(usize, Range<usize>)>` violate assumptions in `helix_core::syntax::Merge`. * When we push a new range, we check it against the last range and merge the two if they overlap. This is safe because they both have the same severity and therefore highlight. The actual merge is skipped for any of these when they are empty, so this is very fast in practice. For some data, I threw together an FPS counter which renders as fast as possible and logs the renders per second. With no diagnostics, I see an FPS gain from this change from 868 FPS to 878 (+1.1%) on a release build on a Rust file. On an Erlang file with 12 error diagnostics and 6 warnings in view (233 errors and 66 warnings total), I see a decrease in average FPS from 795 to 790 (-0.6%) on a release build.
* 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.
* Propagate idle timeout event to components (#3172)Gokul Soumya2022-10-11
|
* 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`).
* 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>
* Add `ui.gutter.selected` option for themes (#3303)ChrHorn2022-10-03
| | | | | * add `ui.gutter.selected` * add `ui.gutter`, `ui.gutter.selected` to docs
* 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
* initial implementation of bufferline (#2759)aaron4042022-09-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * initial implementation of bufferline * fixed lint * changed to 'bufferline', added enum for config modes, some cleanup * fixed lint * added file modification indicator * removed redundant code, added proper themeing with fallback, changed 'file modified' indicator * remove commented code * Update helix-term/src/ui/editor.rs simplify text and offset computation Co-authored-by: Gokul Soumya <gokulps15@gmail.com> * add ui.bufferline.background key for themes Co-authored-by: lazytanuki <43273245+lazytanuki@users.noreply.github.com> * address PR comments * Update helix-term/src/ui/editor.rs * simplify computation of editor area: * change to set_stringn to avoid overflow * Update configuration.md Updates documentation to reflect decision re: defaulting to never showing bufferline. * addressed pr comments * fix build error * address pr comments * revert accidental change Co-authored-by: Gokul Soumya <gokulps15@gmail.com> Co-authored-by: lazytanuki <43273245+lazytanuki@users.noreply.github.com> Co-authored-by: Seth Bromberger <sbromberger@users.noreply.github.com>
* Fix closing buffer with custom keymap (#3633)A-Walrus2022-09-01
| | | | | * Fix closing buffer with custom keymap * Add comment explaining if
* Make mode editor-wide rather than per-documentBlaž Hrastnik2022-09-01
|
* Avoid command execution hooks on closed docs (#3613)Michael Davis2022-08-31
| | | | | | | | | Fixes a panic with a config like: [keys.normal.space] x = [":buffer-close"] by bailing out of the command-execution handling if the document doesn't exist after handling a command.
* Move mode transition logic to handle_keymap_event() (#2634)Lucy2022-08-31
| | | | | Co-authored-by: Blaž Hrastnik <blaz@mxxn.io> Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
* Use the original document and view for mode transition hooks (#3508)Michael Davis2022-08-31
| | | | | | | When changing focus, the lookup with `current!` may change the view and end up executing mode transition hooks on the newly focused view. We should use the same view and document to execute mode transition hooks so that switching away from a view triggers history save points.
* Add bracketed paste (#3233)Charlie Groves2022-08-29
|
* fix: Reset document mode when losing focusBlaž Hrastnik2022-08-23
| | | | Fixes #3090
* Update to crossterm-0.25 (#3390)Charlie Groves2022-08-22
|
* Switch to `tabpad` configuration option (#3458)A-Walrus2022-08-21
| | | | Virtual whitespace tabs are created from the `tab` character padded with `tabpad` up to the tab width.
* 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>
* Fix tab highlight when tab is partially visible (#3313)A-Walrus2022-08-06
| | | | | | | | | | * Fix tab highlight when tab is partially visible * Make it style based, and not truncation based Dealing with truncating is a mess, especially when it comes to wide unicode graphemes. This way it should work no matter what. * Inline style calculation into branches
* Fix indent guide styling (#3324)A-Walrus2022-08-06
| | | | | | | | | | | | | | * Fix incorrect indent guide styling Before the indent guides on top of whitespace inherited the theme from them. Now they do not. * Fix dark_plus theme indent_guides * Use whitespace style as fallback for indent-guide * Fix dark_plus theme indent_guides * Move indent_guide style patching out of loop
* Avoid copying fragments (#3136)Matthias Deiml2022-08-04
| | | | | | | * Avoid copying fragments * Add slice / slices method * Better documentation for fragment and slice methods
* Resolve clippy lints (#3307)Omnikar2022-08-04
|
* fix: Indent levels could bleed over on the left edgeBlaž Hrastnik2022-07-20
| | | | | | Fixes #3087 Refs #3105 # modified: theme.toml
* Add lsp signature help (#1755)Gokul Soumya2022-07-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add lsp signature help * Do not move signature help popup on multiple triggers * Highlight current parameter in signature help * Auto close signature help * Position signature help above to not block completion * Update signature help on backspace/insert mode delete * Add lsp.auto-signature-help config option * Add serde default annotation for LspConfig * Show LSP inactive message only if signature help is invoked manually * Do not assume valid signature help response from LSP Malformed LSP responses are common, and these should not crash the editor. * Check signature help capability before sending request * Reuse Open enum for PositionBias in popup * Close signature popup and exit insert mode on escape * Add config to control signature help docs display * Use new Margin api in signature help * Invoke signature help on changing to insert mode
* Make gutters padding optional (#2996)Ivan Tham2022-07-18
| | | | If all gutters are removed, there are still an extra one padding, would be nice to remove that to save some space.
* Customizable/configurable status line (#2434)Mr. E2022-07-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * feat(statusline): add the file type (language id) to the status line * refactor(statusline): move the statusline implementation into an own struct * refactor(statusline): split the statusline implementation into different functions * refactor(statusline): Append elements using a consistent API This is a preparation for the configurability which is about to be implemented. * refactor(statusline): implement render_diagnostics() This avoid cluttering the render() function and will simplify configurability. * feat(statusline): make the status line configurable * refactor(statusline): make clippy happy * refactor(statusline): avoid intermediate StatusLineObject Use a more functional approach to obtain render functions and write to the buffers, and avoid an intermediate StatusLineElement object. * fix(statusline): avoid rendering the left elements twice * refactor(statusline): make clippy happy again * refactor(statusline): rename `buffer` into `parts` * refactor(statusline): ensure the match is exhaustive * fix(statusline): avoid an overflow when calculating the maximal center width * chore(statusline): Describe the statusline configurability in the book * chore(statusline): Correct and add documentation * refactor(statusline): refactor some code following the code review Avoid very small helper functions for the diagnositcs and inline them instead. Rename the config field `status_line` to `statusline` to remain consistent with `bufferline`. * chore(statusline): adjust documentation following the config field refactoring * revert(statusline): revert regression introduced by c0a1870 * chore(statusline): slight adjustment in the configuration documentation * feat(statusline): integrate changes from #2676 after rebasing * refactor(statusline): remove the StatusLine struct Because none of the functions need `Self` and all of them are in an own file, there is no explicit need for the struct. * fix(statusline): restore the configurability of color modes The configuration was ignored after reintegrating the changes of #2676 in 8d28f95. * fix(statusline): remove the spinner padding * refactor(statusline): remove unnecessary format!()
* Add mode specific styles (#2676)Mathspy2022-06-30
| | | | | | | | | | | | | * Add mode specific styles In similar vein to neovim's lualine and similar statusline packages this allows helix users to style their mode based on which mode it is thus making each mode more visually distinct at a glance * Add an example based on rosepine * Add editor.colors-mode config * Document statusline mode styles