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
Nathan Vegdahl
85d5b399de
Merge branch 'master' into great_line_ending_and_cursor_range_cleanup
3 years ago
Nathan Vegdahl
6e15c9b874
Make vertical selection movement work properly.
3 years ago
dependabot[bot]
c8681a820c
Bump unicode-segmentation from 1.7.1 to 1.8.0
...
Bumps [unicode-segmentation](https://github.com/unicode-rs/unicode-segmentation ) from 1.7.1 to 1.8.0.
- [Release notes](https://github.com/unicode-rs/unicode-segmentation/releases )
- [Commits](https://github.com/unicode-rs/unicode-segmentation/compare/1.7.1...v1.8.0 )
---
updated-dependencies:
- dependency-name: unicode-segmentation
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
3 years ago
Ivan Tham
6ccfa229ed
Fix typo on comment in surround
3 years ago
Gokul Soumya
351c1e7e55
Fix surround bug when cursor on same pair
...
For example when the cursor is _on_ the `'` in `'word'`, the cursor
wouldn't move because the search for a matching pair started _from_ the
position of the cursor and simply found itself.
3 years ago
Gokul Soumya
c68fe1f2a3
Add object selection (textobjects) ( #385 )
...
* Add textobjects for word
* Add textobjects for surround characters
* Apply clippy lints
* Remove ThisWordPrevBound in favor of PrevWordEnd
It's the same as PrevWordEnd except for taking the current char
into account, so use a "flag" to capture that usecase
* Add tests for PrevWordEnd movement
* Remove ThisWord* movements
They did not preserve anchor positions and were only used
for textobject boundary search anyway so replace them with
simple position finding functions
* Rewrite tests of word textobject
* Add tests for surround textobject
* Add textobject docs
* Refactor textobject word position functions
* Apply clippy lints on textobject
* Fix overflow error with textobjects
3 years ago
Nathan Vegdahl
28d2d68804
Make horizontal selection movement work properly.
3 years ago
Kirawi
c5b2973739
`:reload` ( #374 )
...
* reloading functionality
* fn with_newline_eof()
* fmt
* wip
* wip
* wip
* wip
* moved to core, added simd feature for encoding_rs
* wip
* rm
* .gitignore
* wip
* local wip
* wip
* wip
* no features
* wip
* nit
* remove simd
* doc
* clippy
* clippy
* address comments
* add indentation & line ending change
3 years ago
Nathan Vegdahl
22dca3b111
Allow last line in file to lack a line break character.
3 years ago
Perry Thompson
e177b27baf
Add missing import
3 years ago
Nathan Vegdahl
230248bbc3
Fix a couple additional `unused` warnings after merge.
3 years ago