Commit Graph

366 Commits (26a55dcefd9774235cd8c40eb2724daa0808e376)

Author SHA1 Message Date
langbamit 36095326d0
Fix auto pairs return wrong selection (#613) 3 years ago
Cor Peters ac3c1719c9
Fixes crash on empty rust file. (#592)
Fixes #591

Co-authored-by: Cor Peters <luctius@gmail.com>
3 years ago
Blaž Hrastnik 1caedc18ca Release v0.4.1 3 years ago
Blaž Hrastnik b635e35818 Appease clippy 3 years ago
Blaž Hrastnik fd1eaafff5 Add :tree-sitter-scopes, useful when developing indents.toml 3 years ago
Blaž Hrastnik 7c834d6506 fix: tree sitter rendering glitches with multiple selection edits 3 years ago
Blaž Hrastnik 3de40de0a9 fix build... 3 years ago
Blaž Hrastnik 733ee06b7b Release v0.4.0 3 years ago
Nathan Vegdahl b5223618ed Document `pos_at_coords` better.
Particularly the effect of the `limit_before_line_ending`
parameter.
3 years ago
Nathan Vegdahl 953125d3f3
Fix around-word text-object selection. (#546)
* Fix around-word text-object selection.

* Text object around-word: select to the left if no whitespace on the right.

Also only select around when there's whitespace at all.

* Make select-word-around select all white space on a side.

* Update commented-out test case.

* Fix unused import warning from rebase.
3 years ago
Nathan Vegdahl c9cbc344fc Fix buggy surround behavior from #376.
Fixes #543.
3 years ago
Blaž Hrastnik 62eb8c6b40 mouse: Remove verify_screen_coords, refactor primary selection modification 3 years ago
Blaž Hrastnik 0fdb626c2c Remove embed_runtime feature
It's no longer practical to maintain. Closes #451
3 years ago
Nathan Vegdahl f88d4c1e20 Move indent-style code into `helix_core::indent`. 3 years ago
Nathan Vegdahl 3fda350494 Fixes for new clippy lints in Rust 1.54. 3 years ago
Nathan Vegdahl cd7302ffd3 Enforce cursor/selection invariants in one place.
Rather than per-command like before.
3 years ago
Nathan Vegdahl aead4e69a6 Minor cleanup of the vertical movement code. 3 years ago
Nathan Vegdahl 84f8167fd1 Use `match` for branching on the `Direction` enum in more places. 3 years ago
Nathan Vegdahl 5229c5387f Add unit tests for some of the new `Range` methods. 3 years ago
Nathan Vegdahl b2c76dc627 Improve `Range` documentation and organization. 3 years ago
Nathan Vegdahl f62ec6e51e Merge branch 'master' into great_line_ending_and_cursor_range_cleanup 3 years ago
Nathan Vegdahl 5ee6ba5b38 Address some PR comments. 3 years ago
Nathan Vegdahl 0883b4fae0 Collect some common patterns into methods on `Range`. 3 years ago
Ivan Tham f7c8500797 Fix append newline indent
Fix #492
3 years ago
Blaž Hrastnik 63e54e30a7 Implement in-memory prompt history
Implementation is similar to kakoune: we store the entries into
a register.
3 years ago
Omnikar 112ae5cffe
Determine whether to use a margin of 0 or 1 when uncommenting (#476)
* Implement `margin` calculation for uncommenting

* Move `margin` calculation to `find_line_comment`

* Fix comment bug with multiple selections on a line

* Fix `find_line_comment` test for new return type

* Generate a single vec of lines for comment toggle

`toggle_line_comments` collects the lines covered by all selections into
a `Vec`, skipping duplicates. `find_line_comment` now returns the lines
to operate on, instead of returning the lines to skip.

* Fix test for `find_line_comment`

* Reserve length of `to_change` instead of `lines`

The length of `lines` includes blank lines which will be skipped, and as
such do not need space for a change reserved for them. `to_change`
includes only the lines which will be changed.

* Use `token.chars().count()` for token char length

* Create `changes` with capacity instead of reserving

* Remove unnecessary clones in `test_find_line_comment`

* Add test case for 0 margin comments

* Add comments explaining `find_line_comment`
3 years ago
Nathan Vegdahl f96b8b769b Switch to a cleaner range-head moving abstraction.
Also fix a bunch of bugs related to it.
3 years ago
Nathan Vegdahl 43594049dd Merge branch 'master' into great_line_ending_and_cursor_range_cleanup 3 years ago
Nathan Vegdahl ad814b8c2e Fix append mode, and make insertion always happen at head of range. 3 years ago
Nathan Vegdahl ffb8057a7f Fix ocassional panic when matching brackets. 3 years ago
Nathan Vegdahl fd684ef693 Revert display-width-based vertical cursor movement.
Still needs to be done, but should be part of a separate PR.
3 years ago
Nathan Vegdahl 5841954f58 Calculate the line that the range head is on correctly. 3 years ago
fossdd d4bd5b3766 The item `fmt` was imported redundantly
Fixed warning:

```
warning: the item `fmt` is imported redundantly
  --> helix-core/src/syntax.rs:98:9
   |
16 |     fmt,
   |     --- the item `fmt` is already imported here
...
98 |     use std::fmt;
   |         ^^^^^^^^
   |
```
3 years ago
Nathan Vegdahl bc85c85501 Fix selections not being modified quite correctly with text edits. 3 years ago
Nathan Vegdahl c848ed7abc Fixes for misc bugs with view movement. 3 years ago
Nathan Vegdahl c9300ec35f Fix comment toggle command also sometimes toggling the next line. 3 years ago
Nathan Vegdahl 1c6b5581f0 Fix various bugs related to goto-end-of-line command.
This also fixes a bug with `Selection::normalize()`, that could
result in an out-of-bounds primary index.
3 years ago
Nathan Vegdahl c400a60377 Fix `Selection::push()` to make the pushed range primary.
Apparently I accidentally deleted that behavior in the cleanup.
3 years ago
Nathan Vegdahl e98d669c30 Handle edge case in `range_to_target()` correctly. 3 years ago
Nathan Vegdahl b0311f4fc2 Fixed primary cursor position calculation to use 1-width semantics.
This had a bunch of knock-on effects that were buggy, such as bracket
match highlighting.
3 years ago
Nathan Vegdahl e462f32723 Merge branch 'master' into great_line_ending_and_cursor_range_cleanup 3 years ago
Nathan Vegdahl 6c038bb015 Update word selection/navigation to work with gap indexing.
Also tweaked some of the existing behavior that seemed inconsistent
and/or buggy.  It's mostly identical, just a few corner cases are
different.
3 years ago
Blaž Hrastnik bf43fabf65 Remove ExactSizeIterator requirement on Transaction::change
Size hint is enough.
3 years ago
Cor Peters cd65a48635
Made toggle_comments language dependent (#463)
* Made toggle_comments language dependent

* Fixed Test Cases

* Added clippy suggestion

* Small Fixes

* Clippy Suggestion

Co-authored-by: Cor <prive@corpeters.nl>
3 years ago
Cor Peters 0aa43902ca
Added option to provide a custom config file to the lsp. (#460)
* Added option to provide a custom config file to the lsp.

* Simplified lsp loading routine with anyhow

* Moved config to language.toml

* Fixed test case

* Cargo fmt

* Revert now-useless changes

* Renamed custom_config to config

Co-authored-by: Cor <prive@corpeters.nl>
3 years ago
Nathan Vegdahl a77274e8bb Merge branch 'master' into great_line_ending_and_cursor_range_cleanup 3 years ago
Blaž Hrastnik dd2903ff10 Dynamically load grammar libraries at runtime 3 years ago
Nathan Vegdahl b4c59b444c Update surround commands to work with gap indexing. 3 years ago
Kirawi 084a8a9522
Rewritten Rust `highlights.scm` (#425)
* rewrote Rust highlights.scm

* wip

* wip

* wip

* wip

* fixed type highlighting

* wip

* rewrite again

* moved operators

* missing newline

* missing newline

* update book

* fix constructor highlighting

* fix constructor highlighting

* fix const highlighting

* better constructor highlighting

* remove dup, bug was my locals.scm file

* fixed docs

* merge

* fixed for highlighting

* add yield

* remove yield

* added yield back

* fixed yield highlighting

* unecessary
3 years ago
Nathan Vegdahl 753f7f381b Implement `Range::put()` which manages range movements and extensions.
In particular, this wraps the annoying logic involved in keeping the
cursor width to 1 grapheme.
3 years ago