1
0
Fork 0
mirror of https://github.com/helix-editor/helix synced 2024-06-02 08:06:07 +02:00
Commit Graph

264 Commits

Author SHA1 Message Date
Rino 4d548a0ee3
Parse gutter-types as Strings (#5696)
This is necessary for configurations like:

    [editor]
    gutters = ["diagnostics", "line-numbers"]

after the toml 0.6.0 dependency update.
2023-01-26 16:29:29 -06:00
Jonathan LEI 769fb5fe97
Make clippy happy on Windows (#5644) 2023-01-23 19:21:34 +05:30
Doug Kelkhoff 2b58ff4d7c
Add configuration for min width of line-numbers gutter (#4724) 2023-01-21 14:20:59 -06:00
Ivan Tham a20a96abdc
Remove apply_transaction helper (#5598) 2023-01-21 12:13:43 -06:00
mejo13 e7e47fd542
Add command to rotate view backward (#5356) 2023-01-17 16:15:21 -06:00
Pascal Sommer 75dfaff338
Add some function documentations (#5360) 2023-01-10 20:11:43 -06:00
Nick c9ed42cdec
Add a status line element that shows just the basename of the file (#5318) 2022-12-31 08:18:14 -06:00
Michael Davis cdc54f50a2
Reset mode when changing buffers (#5072)
* Reset mode when changing buffers

This is similar to the change in
e4c9d4082a139aac3aea4506918171b96e81f5b9: reset the editor to normal
mode when changing buffers. Usually the editor is already in normal
mode but it's possible to setup insert-mode keybindings that change
buffers.

* Move normal mode entering code to Editor

This should be called internally in the Editor when changing documents
(Editor::switch) or changing focuses (Editor::focus).
2022-12-12 00:04:08 +09:00
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>
2022-12-01 17:35:23 +09:00
Michael Davis 260341ed80 Sync all document changes on view focus 2022-11-30 01:15:20 +09:00
Michael Davis 056a19a003 Sync changes between doc and view on switch 2022-11-30 01:15:20 +09:00
Michael Davis 8529d756fa
Remove selections for closed views on all documents (#4888)
Previously we removed selections for a closed view on only the
currently focused document. A view might have selections in other
documents though, so the view needs to be removed from all documents.
2022-11-26 11:52:22 +09:00
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.
2022-11-17 09:59:59 +09:00
Gaurav Tyagi 91ff903bf3
Add global error/warning count statusline element (#4569) 2022-11-14 19:46:07 -06:00
wes adams fd585c1ee4
Statusline indicator to show number of selected chars (#4682)
Co-authored-by: wes adams <wadams@grayshift.com>
2022-11-12 11:31:09 -06:00
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
2022-11-08 21:19:59 +09:00
Blaž Hrastnik c2c1280f02
Resolve a bunch of upcoming clippy lints 2022-11-04 21:06:28 +09:00
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>
2022-11-03 15:09:21 +09:00
Charlie Groves 1bed2f3043
Use OSC 52 as a fallback for setting the system clipboard (#3220)
This adds a simple base64 implementation to keep us from adding a crate for one function. It's
mostly based on
a675443d32/src/engine/naive.rs (L42)
2022-11-02 10:12:40 +09:00
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>
2022-10-21 10:35:02 +09:00
Matouš Dzivjak e25af1f744
feat(view): re-use align_view function (#4390) 2022-10-20 18:53:05 -05:00
Skyler Hawthorne 9a406b569b reduce LSP timeout to 3s 2022-10-18 22:31:39 -04:00
Skyler Hawthorne 759d55cc81 fail if doc save sender is closed 2022-10-18 22:31:39 -04:00
Skyler Hawthorne e645804b0a Editor::flush_writes returns an error 2022-10-18 22:31:39 -04:00
Blaž Hrastnik 1b6f7319cd Wire up save_queue as a part of new_document rather than open 2022-10-18 22:31:39 -04:00
Blaž Hrastnik b155e861ad Use a write_count to determine how many writes left to flush 2022-10-18 22:31:39 -04:00
Blaž Hrastnik b0212b3611 Deduplicate flush_writes 2022-10-18 22:31:39 -04:00
Blaž Hrastnik 30c93994b5 Use a single save_queue on the editor 2022-10-18 22:31:39 -04:00
Skyler Hawthorne f82a551b98 Rename doc save event names to past tense 2022-10-18 22:31:39 -04:00
Skyler Hawthorne faa00d4cc3 increase LSP shutdown timeout
The Clang LAP takes a long time to shut down on Windows
2022-10-18 22:31:39 -04:00
Skyler Hawthorne cb23399dee improve reliability of shutdown 2022-10-18 22:31:38 -04:00
Skyler Hawthorne e1f7bdb1d2 fix buffer-close 2022-10-18 22:31:38 -04:00
Skyler Hawthorne a5a93182cd fix: buffer-close ensuring writes
Make sure buffer-close waits for the document to finish its writes.
2022-10-18 22:31:38 -04:00
Skyler Hawthorne d706194597 chore(write): serialize write operations within a Document
The way that document writes are handled are by submitting them to the
async job pool, which are all executed opportunistically out of order. It
was discovered that this can lead to write inconsistencies when there
are multiple writes to the same file in quick succession.

This seeks to fix this problem by removing document writes from the
general pool of jobs and into its own specialized event. Now when a
user submits a write with one of the write commands, a request is simply
queued up in a new mpsc channel that each Document makes to handle its own
writes. This way, if multiple writes are submitted on the same document,
they are executed in order, while still allowing concurrent writes for
different documents.
2022-10-18 22:31:38 -04:00
A-Walrus 2c36e33e0a Make skip_levels a u8 2022-10-18 00:38:16 +09:00
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)
2022-10-18 00:38:16 +09:00
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.
2022-10-09 03:28:42 +09:00
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`).
2022-10-04 00:14:57 +09:00
A-Walrus 1d8bb2249b
Change focus to modified docs on quit (#3872)
* Change focus to modified docs on quit

When quitting with modified documents, automatically switch focus to
one of them.

* Update helix-term/src/commands/typed.rs

Co-authored-by: Poliorcetics <poliorcetics@users.noreply.github.com>

* Make it work with buffer-close-all and the like

* Cleanup

Use Cow instead of String, and rename DoesntExist -> DoesNotExist

Co-authored-by: Poliorcetics <poliorcetics@users.noreply.github.com>
2022-10-04 00:07:21 +09:00
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>
2022-10-04 00:07:04 +09:00
ath3 7c9809eeb2
Find workspace from document path (#3553) 2022-10-04 00:02:49 +09:00
Joshua Pauline c144cc0b04
feat(statusline): add option to show total line numbers in file (#3960)
* feat(statusline): add option to show total line numbers in file

* feat(line numbers): add config to doc book
2022-10-03 23:54:00 +09:00
PeepNSheep 77f33e7b20
Add configureable statusline mode names (#3311)
* Added 'long-mode' statusline element

* Added customizable statusline mode names

* Removed a string clone

* Added documentation

* Updated documentation, moved modenames to a seperate section

* Update configuration.md

* Documentation update

* Documentation update

* Documentation update

* Update configuration.md

* Update configuration.md

* Fixed merge error

* Update configuration.md

* Update configuration.md
2022-10-03 23:45:32 +09:00
Joe bcba5d67f9
Add goto preview (#2982) 2022-10-03 23:33:20 +09:00
Blaž Hrastnik a123fb6057
Remove LspNotDefined, instead return an Option<> 2022-09-07 16:42:33 +09:00
Blaž Hrastnik 6ec4017a8d
Expand doc/view macros to allow fetching specific id
This simplifies the code and hides away unwraps
2022-09-03 12:36:06 +09:00
aaron404 e8730ca5fd
initial implementation of bufferline (#2759)
* initial implementation of bufferline

* fixed lint

* changed to 'bufferline', added enum for config modes, some cleanup

* fixed lint

* added file modification indicator

* removed redundant code, added proper themeing with fallback, changed 'file modified' indicator

* remove commented code

* Update helix-term/src/ui/editor.rs

simplify text and offset computation

Co-authored-by: Gokul Soumya <gokulps15@gmail.com>

* add ui.bufferline.background key for themes

Co-authored-by: lazytanuki <43273245+lazytanuki@users.noreply.github.com>

* address PR comments

* Update helix-term/src/ui/editor.rs

* simplify computation of editor area:

* change to set_stringn to avoid overflow

* Update configuration.md

Updates documentation to reflect decision re: defaulting to never showing bufferline.

* addressed pr comments

* fix build error

* address pr comments

* revert accidental change

Co-authored-by: Gokul Soumya <gokulps15@gmail.com>
Co-authored-by: lazytanuki <43273245+lazytanuki@users.noreply.github.com>
Co-authored-by: Seth Bromberger <sbromberger@users.noreply.github.com>
2022-09-02 11:39:38 +09:00
Blaž Hrastnik 5c2b77b41f
Make mode editor-wide rather than per-document 2022-09-01 16:14:38 +09:00
unrelentingtech 51b62230da
Add wezterm to get_terminal_provider (#3588)
https://github.com/wez/wezterm is a terminal emulator with its own built-in multiplexer
2022-08-29 09:24:22 +09:00
Blaž Hrastnik e4c9d4082a
fix: Reset document mode when losing focus
Fixes #3090
2022-08-23 14:07:50 +09:00