Commit Graph

39 Commits (e20886dd6058a0b31fb99fb71a523b2ec3dfec64)

Author SHA1 Message Date
wes adams 19694877aa
When buffer closes, focus on parent buffer (#4766) 2 years ago
Michael Davis b474ee1843
Factor out common code for focusing the next view (#4607)
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.
2 years ago
Doug Kelkhoff 7ed9e9cf25
Dynamically resize line number gutter width (#3469)
* 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
2 years ago
A-Walrus c93d52cc8a
Fix cargo doc warnings, and add GitHub action to ensure it (#3650) 2 years ago
A-Walrus 45dbcb6783
Fix closing buffer with custom keymap (#3633)
* Fix closing buffer with custom keymap

* Add comment explaining if
2 years ago
Blaž Hrastnik e4c9d4082a
fix: Reset document mode when losing focus
Fixes #3090
2 years ago
Robin 19b7864062
keep jump/file history when using :split (#3031)
* keep jump/file history when using :split

* move history cloning into the switch function

Co-authored-by: Robin <robinvandijk@klippa.com>
2 years ago
Termina94 a17626a822
add history suggest to global search (#2717)
Co-authored-by: Dean Revell <revell@gmail.com>
2 years ago
Roland Kovacs 6bd8924436 Move Tree nodes on view swap
Instead of moving the Node contents on view swap if they have the same parent
reorder them to keep traversal order otherwise re-parent them.
2 years ago
Roland Kovacs 3f10473d30 Implement view swapping
* add Tree::swap_split_in_direction()
* add swap_view_{left,down,up,right} commands, bound to H,J,K,L
  respectively in the Window menu(s)
* add test for view swapping
2 years ago
Roland Kovacs 8958bf0a92
Implement view transpose (#2461)
Change the layout of existing split view from horizontal to vertical and
vica-versa. It only effects the focused view and its siblings, i.e. not
recursive.

Command is mapped to 't' or 'C-t' under the Window menus.
2 years ago
Dr. David A. Kunz b04c425c63
Make gutters configurable (#1967)
* config option line numbers none

* view tests

* added tests

* doc

* comment

* Make gutters configurable

* docu

* docu

* rm none docu

* order

* order

* precedence

* simpler

* rm todo

* fixed clippy

* order

* double quotes

* only allow diagnostics and line-numbers

* tests

* docu

* format

* rm short variant and more docu

* performance improvements

* typo

* rename
2 years ago
Blaž Hrastnik 0062af6a19
minor: Remove some outdated comments 2 years ago
Cole Helbling c638b6b60e
helix-term/commands: implement buffer-close (bc, bclose) (#1035)
* 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
3 years ago
Oskar Nehlin 0f886af4b9
Add commands for moving between splits with a direction (#860)
* Add commands for moving between splits with a direction

* Update keymaps

* Change picker mapping

* Add test and clean up some comments
3 years ago
Ivan Tham 17f9dfce7e Fix typo 3 years ago
Keith Simmons 4418e17547
reverse the dependency between helix-tui and helix-view (#366)
* 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>
3 years ago
wojciechkepka 0882712b45 Use full screen size 3 years ago
Ivan Tham 7cc13fefe9 Derive debug without feature
Note that this also removed those `finish_non_exhaustive()`.
3 years ago
notoria 1a3a924634 Implement Debug for data structure as a feature 3 years ago
Blaž Hrastnik c0332bd935 Fix split sizes getting out of sync with the terminal size, refs #69 3 years ago
Blaž Hrastnik 52da68e49a Render a separator between vertical splits. 3 years ago
Blaž Hrastnik 9f318a8529 Fix an issue with closing nested splits.
The parent id was never assigned to the split, so removing the container
when it became empty failed.
3 years ago
Blaž Hrastnik 8b33ba2284 Correct the naming issue with vsplit and hsplit being swapped. 3 years ago
Blaž Hrastnik ceea5eacd8 clippy lint 3 years ago
Blaž Hrastnik 8a0ab447ec editor.open can now either replace the current view or open in a split. 3 years ago
Blaž Hrastnik b24cdd1295 Derive a separate ViewId type. 3 years ago
Blaž Hrastnik 8328fe926d Drop refcell use, make view simply ref doc.id. 3 years ago
Blaž Hrastnik 6336c1da20 view: Reposition cursors on tree resize. 3 years ago
Blaž Hrastnik 8b9b02f08b minor 3 years ago
Blaž Hrastnik 7da6bd6a71 commands: Simplify some code, only calling cx.doc() once. 3 years ago
Blaž Hrastnik 7877647cf0 Allow closing individual views. 3 years ago
Blaž Hrastnik 0827c45d94 view: Disable tree.fullscreen for now to appease clippy. 3 years ago
Blaž Hrastnik 5e73f83efa Implement vertical split calculations. 3 years ago
Blaž Hrastnik a924ad2885 simplify. 3 years ago
Blaž Hrastnik c70080dd68 Work around rendering errors for positions offscreen. 3 years ago
Blaž Hrastnik 8f0ddf9632 Address clippy warnings. 3 years ago
Blaž Hrastnik 9c33b5340a A dumb "next view" implementation that works. 3 years ago
Blaž Hrastnik 5554910e08 Forgot to add the tree.rs definition... 3 years ago