| Commit message (Collapse) | Author | Age |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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>
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
* Add `View::ensure_cursor_in_view_center` to adjust view after searching and jumping
Also `offset_coodrs_to_in_view` was refactored to reduce duplicated position calculations.
* Fix a wrong offset calculation in `offset_coords_to_in_view_center`
It ignored `scrolloff` if `centering` is false.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously, jumplists could grow unchecked. Every transaction is
applied to jumplist selections to ensure that they are up to date
and within document bounds, so this would cause every edit to become
more expensive as jumplist lengths increased throughout a session.
Setting a maximum number of entries limits the cost.
Vim and Neovim limit their jumplists:
* https://github.com/vim/vim/blob/b298fe6cbae3b240b10dbd55d9c38d0cc8e033d3/src/structs.h#L141
* https://github.com/neovim/neovim/blob/e8cc489accc435076afb4fdf89778b64f0a48473/src/nvim/mark_defs.h#L57
Notably, Kakoune does not. In Kakoune, changes are applied to jumplist
entries lazily as you hit `<C-o>`/`<C-i>` though, so Kakoune doesn't
have the same growing cost concerns. Kakoune also does not have a
concept of a View which limits the cost further.
Vim and Neovim limit to 100. This seems unreasonably high to me so I've
set this to 30 to start. We can increase if this is problematically
low.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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
|
|
|
|
|
|
|
| |
Applying a transaction to a View adjusts the ranges in the jumplist
to ensure that they remain within the text of the document and follow
regular selection invariants (for example, must be have a width of at
least one).
|
| |
|
|
|
|
| |
Remove padding gutter type, and automatically add 1 padding if gutters is
non-empty.
|
|
|
|
|
|
|
| |
* keep jump/file history when using :split
* move history cloning into the switch function
Co-authored-by: Robin <robinvandijk@klippa.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* jumplist picker
* remove jumps slicing
Co-authored-by: Benoît Cortier <bcortier@proton.me>
* remove unnecessary deref format! parameter
Co-authored-by: Benoît Cortier <bcortier@proton.me>
Co-authored-by: Benoît Cortier <bcortier@proton.me>
|
|
|
|
| |
If all gutters are removed, there are still an extra one padding, would be nice
to remove that to save some space.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* feat: make `move_vertically` aware of tabs and wide characters
* refactor: replace unnecessary checked_sub with comparison
* refactor: leave pos_at_coords unchanged and introduce separate pos_at_visual_coords
* style: include comment to explain `pos_at_visual_coords` breaking condition
* refactor: use `pos_at_visual_coords` in `text_pos_at_screen_coords`
* feat: make `copy_selection_on_line` aware of wide characters
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Fix panic on close last buffer (#2367)
In certain circumstances it was possible to cause a panic when closing
buffers due to some mishandling of view document history.
A change has been made to delete removed documents from the history of
accessed documents for each view. The ensures we don't attempt to jump
to a deleted document by mistake.
* Move remove document code into View function 'remove_document'
* Replace 'view.jumps.remove' call with 'view.remove_document' call
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* feat(commands): better handling of buffer-close
Previously, when closing buffer, you would loose cursor position in other docs.
Also, all splits where the buffer was open would be closed.
This PR changes the behavior, if the view has also other buffer
previously viewed it switches back to the last one instead of the view
being closed. As a side effect, since the views are persisted,
the cursor history is persisted as well.
Fixes: https://github.com/helix-editor/helix/issues/1186
* Adjust buffer close behavior
* Remove closed documents from jump history
* Fix after rebase
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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
|
| |
|
|
|
|
|
|
| |
Each tab is just wide enough to round to the nearest tab stop.
Refs #1243
|
| |
|
|\ |
|
| |
| |
| | |
Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* 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
|
| | |
|
| | |
|
| | |
|
|\| |
|
| | |
|
| | |
|
|\| |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* 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
|
| | |
|
|\| |
|
| |
| |
| |
| |
| | |
The issue affected files with lots of tabs at the start as well.
Fix #840
|
|/ |
|
|
|
|
|
|
|
|
|
|
| |
* 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
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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
|
|
|
|
| |
Fixes #324
|
| |
|
|
|
|
|
| |
Specifically, test cases for double-width characters and grapheme
clusters.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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>
|
| |
|
| |
|
| |
|