Commit Graph

523 Commits (94fc41a41920fc705f01637e7902f06a1c32d998)

Author SHA1 Message Date
Tobias Menzi 8dc86beabd
Implement cursorline (#2170)
* Implement cursorline

* Binary search possible lines
2 years ago
Blaž Hrastnik 19dccade7c
Merge pull request #2359 from dead10ck/test-harness
Integration testing harness
2 years ago
Termina94 a17626a822
add history suggest to global search (#2717)
Co-authored-by: Dean Revell <revell@gmail.com>
2 years ago
Gokul Soumya 8e8367eea6
Refactor Margin for fine grained control (#2727) 2 years ago
Gokul Soumya 8b67acf130
Format keys identically in statusline and command palette (#2790)
The command palette previously used + as a delimiter for denoting
a single key in a key sequence, (like C+w). This was at odds with
how the statusline displayed them with pending keys (like <C-w>).
This patch changes the palette formatting to the statusline formatting
2 years ago
Gokul Soumya 8ad0b83e30 Make indent guides configurable 2 years ago
Blaž Hrastnik 458b89e21d
Merge branch 'master' into test-harness 2 years ago
Matthew Toohey 6a3f7f2c39
feat: make `move_vertically` aware of tabs and wide characters (#2620)
* 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
2 years ago
A-Walrus 43027d9104
Display highest severity diagnostic in gutter (#2835)
* Display highest severity diagnostic in gutter

* Improve gutter diagnostic performance

Very slight improvement (doesn't really make a difference), iterates over the diagnostics of the line
once instead of twice.

* Add comment justifying unwrap
2 years ago
Skyler Hawthorne ed950fcc56 Add more context; Editor::open doesn't need to own path 2 years ago
Skyler Hawthorne 40120967e9 tests for buffer-close 2 years ago
Skyler Hawthorne 07fc80aece tests for serialized writes 2 years ago
Skyler Hawthorne 0f3c10a021 Fix initial selection of Document in new view
When a new View of a Document is created, a default cursor of 0, 0 is
created, and it does not get normalized to a single width cursor until
at least one movement of the cursor happens. This appears to have no
practical negative effect that I could find, but it makes tests difficult
to work with, since the initial selection is not what you expect it to be.

This changes the initial selection of a new View to be the width of the
first grapheme in the text.
2 years ago
Skyler Hawthorne 502d3290fb improve test harness
* Use new macro syntax for encoding sequences of keys
* Make convenience helpers for common test pattern
* Use indoc for inline indented raw strings
* Add feature flag for integration testing to disable rendering
2 years ago
Henry 15807d5f27
simplify some keymap key names follow up tests (#2694) 2 years ago
Bjorn Ove Hay Andersen 794576a5b0
Update auto-pairs and idle-timeout when the config is reloaded (#2736) 2 years ago
Roland Kovacs c2cc2037b5
Better handling of symlinks (#2718)
- Add file-picker.follow-symlinks configuration option (default is true), this
  also controls if filename and directory completers follow symlinks.

- Update FilePicker to set editor error if opening a file fails, instead of
  panicing.

Fix #1548
Fix #2246
2 years ago
Michael Davis cdeab337cd
simplify fallback for selected line-number theming (#2768) 2 years ago
Blaž Hrastnik 3d9923969a
minor: Simplify Document.language_id() 2 years ago
Henry 8351a82c2c
simplify some keymap key names (#2677) 2 years ago
farwyler f92a25a856
Passing extra formatting options to LSPs (#2635)
* allows passing extra formatting options to LSPs

- adds optional field 'format' to [[language]] sections in 'languages.toml'

- passes specified options the LSPs via FormattingOptions

* cleaner conversion of formatting properties

* move formatting options inside lsp::Client

* cleans up formatting properties merge
2 years ago
gavynriebau b2bd87df81
Fix crash due to cycles when replaying macros (#2647)
In certain circumstances it was possible to get into an infinite loop
when replaying macros such as when different macros attempt to replay
each other.

This commit adds changes to track which macros are currently being
replayed and prevent getting into infinite loops.
2 years ago
gavynriebau 026241cf72
Fix panic on close last buffer (#2367) (#2658)
* 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
2 years ago
Ryan Russell ae12c58f0f
Improve Readability (#2639) 2 years ago
Blaž Hrastnik 5ed6223990
fix: Remove empty scratch buffer from jumplists when removing it
Fixes #1238
2 years ago
Michael Davis 89c0998aee lower MSRV to 1.57.0
This line uses the Display trait for io::ErrorKind which was
stabilized in Rust 1.60.0. We can set MSRV all the way back to
1.57.0 by replacing it with a pretty-print.

Closes #2460.
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
Alexis Kalabura c80ac84978
Run debug console in windows (#2294) 2 years ago
Michael Davis 247ab25bc0
prefer Document::set_selection to inserting selections directly (#2411)
Inserting these with the `HashMap::insert` method evades the call
to `Selection::ensure_invariants`. The effect is that the scratch
buffer (or other buffers opened through these code-paths) can start
with a selection at (0, 0), when a file with equivalent contents ("\n")
would start with (0, 1).

I.e.:

    hx

and

    touch f
    hx f

start with different selections even though they have an equivalent
Rope. With this change they both start with (0, 1).
2 years ago
Kirawi 77ff8d3550
cfg-gate unused functions on macos & windows (#2332) 2 years ago
unrelentingtech 20162a426b
feat(commands): make it possible to disable format-on-save via the 'auto-format' option (#2321) 2 years ago
Blaž Hrastnik ade4cbffaa
Add a nop clipboard provider for wasm 2 years ago
unrelentingtech 2c60798b00
feat(ui): add nbsp (non-breaking space) to rendered whitespace (#2322) 2 years ago
chunghha 3a398eec56
fix typos (#2304) 2 years ago
Matouš Dzivjak 52f5a4228a
feat(commands): better handling of buffer-close (#1397)
* 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
2 years ago
Omnikar e6b865ed0b allow whitespace to be rendered
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
2 years ago
Thomas 5d5b6bab9b
Add rulers option (#2060)
* Add color_column option

* Rename to ruler

Co-authored-by: DeviousStoat <devious@stoat.com>
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
Roland Kovacs a0c6c45c1b
Fix panic when using set-language on a scratch (#1996)
Skip launching a language server if a document doesn't have a valid URL.
2 years ago
Omnikar 660e0e44b2
Add `:write!` to create nonexistent subdirectories (#1839)
* Make `:write` create nonexistent subdirectories

Prompting as to whether this should take place remains a TODO.

* Move subdirectory creation to new `w!` command
2 years ago
Roland Kovacs d962e06e91
Add runtime language configuration (#1794) (#1866)
* Add runtime language configuration (#1794)

* Add set-language typable command to change the language of current buffer.
* Add completer for available language options.

* Update set-language to refresh language server as well

* Add language id based config lookup on `syntax::Loader`.
* Add `Document::set_language3` to set programming language based on language
  id.
* Update `Editor::refresh_language_server` to try language detection only if
  language is not already set.

* Remove language detection from Editor::refresh_language_server

* Move document language detection to where the scratch buffer is saved.
* Rename Document::set_language3 to Document::set_language_by_language_id.

* Remove unnecessary clone in completers::language
2 years ago
جاد a9635659f7
Reintroduce win32yank as a clipboard provider on Linux for WSL2 + Windows 10 (#1912)
* feat(clipboard): reintroduce win32yank for wsl2 linux

* refactor(clipboard): adjust win32yank position to not interrupt wayland/x11

Co-authored-by: jiqb <gthbji@ml1.net>
2 years ago
Blaž Hrastnik c18de0e8f0
fix: Don't rely on FormattingOptions::default()
Refs #1884
2 years ago
Blaž Hrastnik 511f37c736
clipboard: fix import on macOS 2 years ago
Blaž Hrastnik 33510d60f4
cargo fmt 2 years ago
Blaž Hrastnik 8611c5b84e
Refactor clipboard to make it easier to feature gate std::process 2 years ago
Blaž Hrastnik 9a6ee88e66
Split off dap event handlers into helix-view to allow reuse 2 years ago
Gokul Soumya 7b3a3d562c
Move top level lsp config to editor.lsp (#1868)
* Move top level lsp config to editor.lsp

This is mainly done to accomodate the new lsp.signature-help config
option that will be introduced in https://github.com/helix-editor/helix/pull/1755
which will have to be accessed by commands. The top level config
struct is split and moved to different places, making the relocation
necessary

* Revert rebase slipup
2 years ago