Commit Graph

389 Commits (3256b013889eee5f9bc66f58b59386214bc49cf2)

Author SHA1 Message Date
trivernis 3256b01388
Merge remote-tracking branch 'origin/master' 1 year ago
jliaoh df1830ef28
mouse operations respect scrolloff (#5255) 1 year ago
Tshepang Mbambo a8a54be6bc
Fix nightly clippy lints (#4954) 1 year ago
Pascal Kuthe 5a3ff74221
Show (git) diff signs in gutter (#3890)
* 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>
1 year ago
Michael Davis 9a9e462183 Call View::apply within Document::append_changes_to_history 1 year ago
Michael Davis df5457a6e7 Remove eager application of transactions to all views 1 year ago
trivernis e20886dd60
Merge branch 'master' 1 year ago
Michael Davis 4a103db622 Apply inversions to Views on undo/redo
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.
2 years ago
Michael Davis 42e37a571e
Apply transactions to all views (#4733)
* 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>
2 years ago
Blaž Hrastnik 7e99087fa3
minor: render_diagnostics doesn't require &self either 2 years ago
Blaž Hrastnik a640ab6b1f
Avoid repeatedly loading config 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
trivernis 25e095adf1
Merge branch 'colored-indent-guides' 2 years ago
trivernis 3893898ffc
Merge branch 'master' 2 years ago
Michael Davis ba394dca6d
Fix panic from two windows editing the same document (#4570)
* 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>
2 years ago
SoraTenshi bb48889200 Resolve conflicts 2 years ago
SoraTenshi c14320f26e Merge branch 'master' into colored-indent-guides 2 years ago
Michał Zabielski 65edf9c198
fix: repeating repeat operator (#4450) 2 years ago
SoraTenshi 52db599f2b Add style for rainbow ig, dimming, normal and none 2 years ago
trivernis 46b135bdc5
Merge branch 'master' 2 years ago
Michael Davis d7d0d5ffb7
lsp: Resolve completion items missing documentation on idle (#4406)
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.
2 years ago
Charlie Groves 7e29ee6dae
Autosave all when the terminal loses focus (#3178)
* 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>
2 years ago
Skyler Hawthorne b530a86d1f remove Callback::Compositor variant
To reduce likelihood of accidental discarding of important callbacks
2 years ago
Skyler Hawthorne aaa1450678 fix write-quit with auto format
write-quit will now save all files successfully even when there is auto
formatting
2 years ago
A-Walrus 8bbddf90ff Replace `in_bounds` with calculation of end_indent
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.
2 years ago
A-Walrus 1de02a147c Only draw indent guides within bounds
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.
2 years ago
A-Walrus 2c36e33e0a Make skip_levels a u8 2 years ago
A-Walrus 3ba665d804 Fix rendering of lines longer than 2^16
Before things would be cast to u16 earlier than needed, which would
cause problems for insanely long lines (longer than 2^16 ~ 65 thousand)
2 years ago
Michael Davis 5f4f171b73
Fix debug assertion for diagnostic sort order (#4319)
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.
2 years ago
trivernis 1ad06ee586
Merge branch 'master' 2 years ago
trivernis 8b789b6b86
Merge branch 'seperate_code_action' 2 years ago
Michael Davis 65febe0cf4
Overlay all diagnostics with highest severity on top (#4113)
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.
2 years ago
Michael Davis c388e16e09 Add a helper function for applying transactions
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.
2 years ago
Michael Davis 0aedef0333 Apply transactions to Views
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.
2 years ago
Gokul Soumya 001858b11f
Propagate idle timeout event to components (#3172) 2 years ago
A-Walrus c15f1ea274
Add cursorcolumn (#4084)
* 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.
2 years ago
s0LA1337 dbd0932921 Merge branch 'master' into colored-indent-guides 2 years ago
s0LA1337 b02d6d98ce Add get_rainbow method, added a todo for rainbow 2 years ago
trivernis d18a064fad
Merge branch 'colored-indent-guides' 2 years ago
Michael Davis 6cca7375ec
Automatically track pseudo-pending text (#4077)
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`).
2 years ago
Robin 6764744ce9
Add option to skip the first indent guide (#3819)
* 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>
2 years ago
ChrHorn 589d17c758
Add `ui.gutter.selected` option for themes (#3303)
* add `ui.gutter.selected`

* add `ui.gutter`, `ui.gutter.selected` to docs
2 years ago
s0LA1337 16312e3b15 Create new style variable that patches on rainbow enabled 2 years ago
s0LA1337 210a7e1c12 patch full style instead of just the foreground 2 years ago
s0LA1337 5989ba88e7 Adjust to use rainbow style array in themes 2 years ago
s0LA1337 9bbc12d7b6 Remove unnecessary typing 2 years ago
s0LA1337 a27c384dd2 Initial implementation of colored indentation guides 2 years ago
trivernis 423435d12a
Add auto-select of tree explorer nodes when jumping between buffers 2 years ago
trivernis c7492aea1f
Merge branch 'completion' 2 years ago
trivernis 2da81760f5
Merge branch 'master' of github.com:helix-editor/helix 2 years ago