aboutsummaryrefslogtreecommitdiff
path: root/helix-view/src/lib.rs
Commit message (Collapse)AuthorAge
* Refactor Registers to take EditorMichael Davis2023-07-31
| | | | | | | | | | | | | | | | | | | | | | This sets up a new Registers type that will allow us to expand support for special registers. (See the child commits.) We start simple with the regular (`Vec<String>`) registers and the simplest special register, the black hole. In the child commits we will expand these match arms with more special registers. The upcoming special registers will need a few things that aren't possible with the current Registers type in helix-core: * Access to the `Editor`. This is only necessary when reading from registers, so the `&Editor` parameter is only added to `Registers::read`. * Returning owned values. Registers in helix-core returns references to the values backed by the `Vec<String>` but future special registers will need to return owned values. We refactor the return value of the read operations to give `Cow<str>`s and iterators over those. * Returning a `Result` for write/push functions. This will be used by the clipboard special registers.
* 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>
* Remove apply_transaction helper (#5598)Ivan Tham2023-01-21
|
* 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>
* 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
* 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
* 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.
* Fix goto/view center mismatch (#4135)Brandon Dong2022-10-10
|
* Split off dap event handlers into helix-view to allow reuseBlaž Hrastnik2022-03-28
|
* helix-term/commands: display buffer id in pickerCole Helbling2022-02-17
|
* Extract gutters into helix-viewBlaž Hrastnik2021-11-29
|
* Optimize space for DocumentId with NonZeroUsize (#1097)Ivan Tham2021-11-25
| | | Now Option<DocumentId> uses one byte rather than two
* Replace documents SlotMap with BTreeMapBlaž Hrastnik2021-11-04
|
* Regex prompts should have a history with a specifiable registerBlaž Hrastnik2021-09-08
|
* Add infoboxIvan Tham2021-07-04
|
* reverse the dependency between helix-tui and helix-view (#366)Keith Simmons2021-06-25
| | | | | | | | | * reverse the dependency between helix-tui and helix-view by moving a fiew types to view * fix tests * clippy and format fixes Co-authored-by: Keith Simmons <keithsim@microsoft.com>
* Fix previous broken refactor key into helix-viewIvan Tham2021-06-24
| | | | | | | | Need to be used for autoinfo Revert "Revert "Refactor key into helix-view"" This reverts commit 10f9f72232f5789323d689bf0f9cd359715770d6.
* Add system clipboard yank and paste commandsBenoît CORTIER2021-06-20
| | | | | | | | | | | | | | | | | | | This commit adds six new commands to interact with system clipboard: - clipboard-yank - clipboard-yank-join - clipboard-paste-after - clipboard-paste-before - clipboard-paste-replace - show-clipboard-provider System clipboard provider is detected by checking a few environment variables and executables. Currently only built-in detection is supported. `clipboard-yank` will only yank the "main" selection, which is currently the first one. This will need to be revisited later. Closes https://github.com/helix-editor/helix/issues/76
* Revert "Refactor key into helix-view"Blaž Hrastnik2021-06-19
| | | | | | Did not use defaults when custom keymap was used This reverts commit ca806d4f852e934651132fc9570a6110e30f646d.
* Refactor key into helix-viewIvan Tham2021-06-19
| | | | Now also make use of Deserialize for Config.
* Replace `Editor::current` by a macroBenoît CORTIER2021-06-18
| | | | | | | | | This is necessary to workaround ownership issues across function calls. The issue notably arised when implementing the registers into `Editor` and I was getting annoyed again when implementing copy/pasting into system clipboard. The problem is addressed by using macro calls instead of function calls. There is no notable side effect.
* Implement register selectionBenoît CORTIER2021-06-07
| | | | | | User can select register to yank into with the " command. A new state is added to `Editor` and `commands::Context` structs. This state is managed by leveraging a new struct `RegisterSelection`.
* Derive a separate ViewId type.Blaž Hrastnik2021-03-24
|
* Store Document on the Editor type, make View reference it.Blaž Hrastnik2021-03-22
|
* View tree implementation: render multiple split views.Blaž Hrastnik2021-02-03
| | | | | Cursors are still a bit buggy and we should render in focus statusbar differently than in the other pane.
* move commands and keymap back to terminal.Blaž Hrastnik2020-12-10
| | | | | Command needs to be able to deal with UI. We'll separate it again later on.
* Refactor: Document type as a wrapper around barebones State.Blaž Hrastnik2020-12-03
|
* Move theme from view to editor, support multiple views in editor.Blaž Hrastnik2020-12-03
|
* Refactor Editor into Application and Editor/Workspace.Blaž Hrastnik2020-10-16
|
* created prompt.rsJan Hrastnik2020-10-16
|
* Split parts of helix-term into helix-view.Blaž Hrastnik2020-09-21
It still largely depends on term for some types but I plan to change that later.