aboutsummaryrefslogtreecommitdiff
path: root/helix-view/src/view.rs
Commit message (Collapse)AuthorAge
* feat(commands): shrink_selection (#1340)Matouš Dzivjak2022-01-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * feat(commands): shrink_selection Add `shrink_selection` command that can be used to shrink previously expanded selection. To make `shrink_selection` work it was necessary to add selection history to the Document since we want to shrink the selection towards the syntax tree node that was initially selected. Selection history is cleared any time the user changes selection other way than by `expand_selection`. This ensures that we don't get some funky edge cases when user calls `shrink_selection`. Related: https://github.com/helix-editor/helix/discussions/1328 * Refactor shrink_selection, move history to view * Remove useless comment * Add default key mapping for extend&shrink selection * Rework contains_selection method * Shrink selection without expand selects first child
* Add last modified file (gm) (#1093)Ivan Tham2021-12-02
|
* Extract gutters into helix-viewBlaž Hrastnik2021-11-29
|
* helix-term/commands: implement buffer-close (bc, bclose) (#1035)Cole Helbling2021-11-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * helix-view/view: impl method to remove document from jumps * helix-view/editor: impl close_document * helix-view/editor: remove close_buffer argument from `close` According to archseer, this was never implemented or used properly. Now that we have a proper "buffer close" function, we can get rid of this. * helix-term/commands: implement buffer-close (bc, bclose) This behaves the same as Kakoune's `delete-buffer` / `db` command: * With 3 files opened by the user with `:o ab`, `:o cd`, and `:o ef`: * `buffer-close` once closes `ef` and switches to `cd` * `buffer-close` again closes `cd` and switches to `ab` * `buffer-close` again closes `ab` and switches to a scratch buffer * With 3 files opened from the command line with `hx -- ab cd ef`: * `buffer-close` once closes `ab` and switches to `cd` * `buffer-close` again closes `cd` and switches to `ef` * `buffer-close` again closes `ef` and switches to a scratch buffer * With 1 file opened (`ab`): * `buffer-close` once closes `ab` and switches to a scratch buffer * `buffer-close` again closes the scratch buffer and switches to a new scratch buffer * helix-term/commands: implement buffer-close! (bclose!, bc!) Namely, if you have a document open in multiple splits, all the splits will be closed at the same time, leaving only splits without that document focused (or a scratch buffer if they were all focused on that buffer). * helix-view/tree: reset focus if Tree is empty
* search_impl will only align cursor center when it isn't in view (#959)CossonLeo2021-11-09
|
* Ensure coords in screen depends on char width (#885)Ivan Tham2021-11-03
| | | | | The issue affected files with lots of tabs at the start as well. Fix #840
* Refactor new Rect construction (#575)Gokul Soumya2021-08-21
| | | | | | | | | | * Refactor new Rect construction Introduces methods that can be chained to construct new Rects out of pre-existing ones * Clamp x and y to edges in Rect chop methods * Rename Rect clipping functions
* Extract view.inner_area(), simplify render_focused_view_elementsBlaž Hrastnik2021-08-19
|
* Refactor view.first_line/first_col into view.offset (Position)Blaž Hrastnik2021-08-19
|
* Show file preview in split pane in fuzzy finder (#534)Gokul Soumya2021-08-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add preview pane for fuzzy finder * Fix picker preview lag by caching * Add picker preview for document symbols * Cache picker preview per document instead of view * Use line instead of range for preview doc * Add picker preview for buffer picker * Fix render bug and refactor picker * Refactor picker preview rendering * Split picker and preview and compose The current selected item is cloned on every event, which is undesirable * Refactor out clones in previewed picker * Retrieve doc from editor if possible in filepicker * Disable syntax highlight for picker preview Files already loaded in memory have syntax highlighting enabled * Ignore directory symlinks in file picker * Cleanup unnecessary pubs and derives * Remove unnecessary highlight from file picker * Reorganize buffer rendering * Use normal picker for code actions * Remove unnecessary generics and trait impls * Remove prepare_for_render and make render mutable * Skip picker preview if screen small, less padding
* fix: Adjust scroll offset/padding calculation to prevent wobbleBlaž Hrastnik2021-08-11
| | | | Fixes #324
* config: Rename [terminal] to [editor] and pass it into EditorBlaž Hrastnik2021-08-08
|
* Add more unit tests for pos_at_screen_coords.Nathan Vegdahl2021-07-31
| | | | | Specifically, test cases for double-width characters and grapheme clusters.
* mouse: Remove verify_screen_coords, refactor primary selection modificationBlaž Hrastnik2021-07-30
|
* Mouse selection support (#509)Dmitry Sharshakov2021-07-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Initial mouse selection support Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com> * Disable mouse event capture if editor crashes Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com> * Translate screen coordinates to view position Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com> * Select full lines by dragging on line numbers Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com> * editor: don't register dragging as a jump Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com> * Count graphemes correctly Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com> * Do not select lines when dragging on the line number bar Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com> * Split out verify_screen_coords Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com> * Do not iterate over the graphemes twice Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com> * Switch view by clicking on it Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com> * Add disable-mouse config option Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com> * Support multiple selections with mouse Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com> * Remove unnecessary check Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com> * Refactor using match expression Co-authored-by: Gokul Soumya <gokulps15@gmail.com> Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com> * Rename local variable Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com> * Rename mouse option Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com> * Refactor code Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com> * Fix dragging selection Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com> * Fix crash when clicking past last line Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com> * Count characters better Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com> * Remove comparison not needed anymore Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com> * Validate coordinates before resolving position Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com> * Tidy up references to editor tree Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com> * Better way to determine line end and avoid overflow Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com> * Fix for last line Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com> * Add unit tests for text_pos_at_screen_coords Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com> Co-authored-by: Gokul Soumya <gokulps15@gmail.com>
* Address some PR comments.Nathan Vegdahl2021-07-26
|
* Collect some common patterns into methods on `Range`.Nathan Vegdahl2021-07-26
|
* Fixes for misc bugs with view movement.Nathan Vegdahl2021-07-21
|
* Fixed primary cursor position calculation to use 1-width semantics.Nathan Vegdahl2021-07-19
| | | | | This had a bunch of knock-on effects that were buggy, such as bracket match highlighting.
* Properly fix `last_line` view calculation.Nathan Vegdahl2021-07-19
| | | | | Turned out to be simpler than I thought. Didn't even need to change the other use-sites.
* 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>
* add alternate file (#223)Robin2021-06-12
| | | | | | | | | | | | | * add alternate file inspired by vim ctrl-6/kak ga commands. the alternate file is kept per view * apply feedback from #223 * rename to last_accessed * add ga doc * add fail message for ga
* Derive debug without featureIvan Tham2021-06-10
| | | | Note that this also removed those `finish_non_exhaustive()`.
* Implement Debug for data structure as a featurenotoria2021-06-10
|
* Fix jump behavior, goto_implementation now jumpIvan Tham2021-06-10
| | | | | Better jump behavior since we override the first jump if it's on the first document. At the same time, ctrl-i is now working with gd jumps.
* Fix Unicode (#135)Kirawi2021-06-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * init * wip * wip * fix unicode break * fix unicode break * Update helix-core/src/transaction.rs Co-authored-by: Benoît Cortier <benoit.cortier@fried-world.eu> * clippy * fix * add changes * added test * wip * wip * wip * wip * fix * fix view * fix #88 Co-authored-by: Benoît Cortier <benoit.cortier@fried-world.eu>
* Fixing Multiple Panics (#121)Kirawi2021-06-05
| | | | | | | * init * wip * wip
* Fix panic when buffer larger than terminal widthRowan Herbert2021-06-02
|
* View::new is infallible, so is editor.switch/new_file.Blaž Hrastnik2021-05-07
|
* Fix the last line calculation inside ensure_cursor_in_viewBlaž Hrastnik2021-04-14
|
* Adjust scroll() to match kakoune: only scroll the view if cursor in bounds.Blaž Hrastnik2021-04-14
|
* Horizontal scrolling! It only took a year to get around to it.Blaž Hrastnik2021-04-09
|
* Weave through view_id references so that views into one file have ↵Blaž Hrastnik2021-03-31
| | | | independent selects.
* Store intra-files jumps (goto) on the jumplist.Blaž Hrastnik2021-03-29
|
* Trivial jumplist implementation.Blaž Hrastnik2021-03-24
|
* Derive a separate ViewId type.Blaž Hrastnik2021-03-24
|
* Drop refcell use, make view simply ref doc.id.Blaž Hrastnik2021-03-23
|
* Store Document on the Editor type, make View reference it.Blaž Hrastnik2021-03-22
|
* Add tab_width and indent_unit config.Blaž Hrastnik2021-03-22
|
* minor: TODO comment cleanupBlaž Hrastnik2021-03-16
|
* Cleanup: use doc.selection() instead of doc.state.selection().Blaž Hrastnik2021-03-14
|
* commands: Improve scroll functions.Blaž Hrastnik2021-03-04
| | | | | Followed kakoune's implementation, it's no longer janky and can scroll all the way in either direction.
* ui: Make editor more resilient about being shrunk too small.Blaž Hrastnik2021-03-01
|
* minor: Simplify some code.Blaž Hrastnik2021-02-24
|
* Allow closing individual views.Blaž Hrastnik2021-02-19
|
* treewide: &RopeSlice -> RopeSlice. It's Copy so no reason to pass by refBlaž Hrastnik2021-02-18
|
* Implement vertical split calculations.Blaž Hrastnik2021-02-09
|
* popup: wip work on completion popupsBlaž Hrastnik2021-02-09
|
* 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.
* clippy lintBlaž Hrastnik2020-12-03
|