Commit Graph

1478 Commits (ac1d8fa505e926d981682317e4e3d289bec4eb49)

Author SHA1 Message Date
Gokul Soumya 3108a11d35
Refactor handling of mouse events (#2893)
- Simplified match statements by destructuring MouseEvent struct
  at the top and then matching on event.kind.
- Extracted out closures for calculating (1) position and view
  of mouse click and (2) gutter coordinates and view of mouse click.
2 years ago
lazytanuki 096abdd19b
feat: highlight / select symbol under cursor using LSP textDocument/documentHighlight (#2738)
* feat: highlight symbol under cursor using LSP textDocument/documentHighlight

* fix: please clippy

* fix: shorter description and code style
2 years ago
Blaž Hrastnik fde9e034d4 Only draw cursorline in the currently focused buffer 2 years ago
Tobias Menzi 8dc86beabd
Implement cursorline (#2170)
* Implement cursorline

* Binary search possible lines
2 years ago
Gokul Soumya a26943de4e
Right align scrollbar with track in completion popup (#2754)
- Align the scollbar to the right edge of the popup rather than at
  a margin of one.
- Add a scrollbar track and a new scope `ui.menu.scroll`.
2 years ago
Gokul Soumya 16ccc7ead8
Add single width left margin for completion popup (#2728)
* Add single width left margin for completion popup

* Clear with ui.menu style before rendering menu

When rendering a completion popup, the popup component will clear
the area with ui.popup and then the menu component would draw over
it using a table component. We remove the left edge of the area
before passing it to the table component (so that it will be left
as padding), and the table component uses ui.menu as the style.
If ui.menu and ui.popup are different the left edge of the popup
will look different from the rest of the popup. We avoid this by
clearing the whole area with ui.menu in Menu::render
2 years ago
Saber Haj Rabiee 3dbad0442f
fixes showing the last prompt on empty input (#2870) 2 years ago
Michael Davis d948ace67b
check selection's visible width when copying on mouse click (#2711)
* check selection's visible width when copying on mouse click

Mouse-click-up copies the selection produced by dragging. The event
is ignored if the selection has a width of 1 though so you don't
copy when clicking rather than dragging. The current check copies
text when it has a visible width of 1 but is actually multiple
characters in the rope like a CRLF line-ending. With this change
we check the unicode width of the character(s) in the selection
rather than the range length, so clicking on a CRLF line-ending
does not copy.

* use range.fragment to simplify getting the primary selection width
2 years ago
farwyler 886cff3bcc
Redetect indent and line endings after language server replaces documents (#2778)
* redetect indent and line endings after language server replaces document

* removes nested if

* always redetect indent and line endings after format

This reverts commit 764d14f55894dc7213e48022dfa0f91829b8ef59.
2 years ago
Seth Bromberger c107f4ea49
fixes #2856 by resetting style on diagnostic (#2861) 2 years ago
Gokul Soumya 301065fe4d
Fix scrollbar length proportional to total menu items (#2860)
The scrollbar length used to increase with more entries in the menu,
which was counter-intuitive to how scrollbars worked in most
applications. Turns out there was a typo in the floor division
implementation :)
2 years ago
Blaž Hrastnik 23b5b1e25a Remove a couple more unwraps 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
ath3 ce85b9716d
Enable shellwords for Windows (with escaping disabled) (#2767) 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
Gokul Soumya 8c4c923e80 Add indent guides support 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
Mathspy fa4934cff9
Default rulers color to red (#2669)
* Default rulers color to red

Currently if the theme a user is using doesn't have `ui.virtual.rulers`
set and they set up a ruler it just fails silently making it really hard
to figure out what went wrong. Did they set incorrectly set the ruler?
Are they using an outdated version of Helix that doesn't support rulers?

This happened to me today, I even switched to the default theme with
the assumption that maybe my theme just doesn't have the rulers setup
properly and it still didn't work.

Not sure if this is a good idea or not, feel free to suggest better
alternatives!

* Use builtin Style methods instead of Bevy style defaults

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>

* Only default the style if there's no ui or ui.virtual

* Update themes style from ui.virtual to ui.virtual.whitespace

* Revert ui.virtual change in onelight theme

* Prefer unwrap_or_else

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
2 years ago
Connor Lay (Clay) 67f6c85792 text-objects: add test capture & elixir queries 2 years ago
Mathis Brossier 8c64c3dfa3
mouse selection now uses character indexing (#2839) 2 years ago
lazytanuki 55f4f69515
fix: do not color health summary when stdout is piped (#2836)
* fix: do not color health summary when stdout is piped

* fix: use crossterm instead of is-terminal
2 years ago
Skyler Hawthorne 665286c199 factor new Application with file arg to function 2 years ago
Skyler Hawthorne 41bf1d5811 fix(command): write-quit: do not quit if write fails
During write-quit, if the file fails to be written for any reason, helix
will still quit without saving the changes. This fixes this behavior by
introducing fallibility to the asynchronous job queues. This will also
benefit all contexts which may depend on these job queues.

Fixes #1575
2 years ago
Skyler Hawthorne 526c9be8ca consolidate idle timer logic, make conditional 2 years ago
Skyler Hawthorne 4e34ee7d2e don't read from stdin for integration tests 2 years ago
Skyler Hawthorne cb0440be85 use env var for integration test log level 2 years ago
Skyler Hawthorne 652cdda833 use test terminal backend for integration tests 2 years ago
Skyler Hawthorne ed950fcc56 Add more context; Editor::open doesn't need to own path 2 years ago
Skyler Hawthorne 2386c81ebc use idle timer instead of fixed timeout 2 years ago
Skyler Hawthorne ee705dcb33 use main application event loop
Use the Application's main event loop to allow LSP, file writes, etc
2 years ago
Skyler Hawthorne 267605d147 reorganize tests into groups 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
Blaž Hrastnik 308cab3e5c Integration testing harness 2 years ago
Blaž Hrastnik adb6cd5376 Simplify handle_terminal_events signature 2 years ago
Skyler Hawthorne 0623a72599 move config parsing back into main 2 years ago
Gygaxis Vainhardt debd2405d9
views -> buffers in write-all (#2788) 2 years ago
Bjorn Ove Hay Andersen 794576a5b0
Update auto-pairs and idle-timeout when the config is reloaded (#2736) 2 years ago
Frojdholm 402f285ba5
Improve markdown list rendering (#2687)
* Cleanup old commented code

* Implement line breaks in markdown rendering

* Implement markdown nested, numbered and multiparagraph lists
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
Ryang Sohn 3bd5545577
Add a check to prevent re-selecting same range (#2760) 2 years ago
Gokul Soumya e9283b20b4
Add docstring for language_server!() macro (#2750) 2 years ago
Frojdholm e0532771cc
Do not add extra line breaks in markdown lists (#2689) 2 years ago
Blaž Hrastnik 26dbdb70fb
Refactor push_jump so we're not needlessly fetching doc twice 2 years ago
Blaž Hrastnik b14c258a2c
prompt: If submitting empty prompt, use default (last used) 2 years ago
Termina94 f1ae496860
Add shell insert commands to typable and config (#2589)
* Add shell insert commands to typable and config

* generate docs

Co-authored-by: Dean Revell <revell@gmail.com>
2 years ago