ath3
6fa76d9fe7
Add trim_selections command ( #1092 )
3 years ago
Blaž Hrastnik
1817b7f581
minor: Import Range too
3 years ago
ath3
35c974c9c4
Implement "Goto last modification" command ( #1067 )
3 years ago
Omnikar
bf95a9ed04
Add `remove_selections` command ( #1065 )
...
* Add `remove_selections` command
* Document `remove_selections`
* Update helix-term/src/keymap.rs
Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
3 years ago
Omnikar
a424ef4e20
Use default `languages.toml` if user's is invalid ( #994 )
3 years ago
Blaž Hrastnik
e18198aeb2
Revert "fix(core): stop merging array toml config values ( #1004 )"
...
It breaks languages.toml merging
This reverts commit 4304b52ff8
.
3 years ago
Blaž Hrastnik
f804ed3192
Make shebangs optional, they don't make sense outside of scripts
3 years ago
Blaž Hrastnik
549cdee561
Refactor shebang detection to reuse the loaded buffer
3 years ago
ath3
77dbbc73f9
Detect filetype from shebang line ( #1001 )
3 years ago
Blaž Hrastnik
82ff5b0ab6
Specify capacity on toggle_line_comments
3 years ago
Daniel S Poulin
1e793c2bbf
Adds single and double quotes to matching pairs ( #995 )
...
This enables `mm` to work on quote characters as well as highlighting of
matching quote when on it.
3 years ago
Omnikar
a252ecd8c8
Add WORD textobject ( #991 )
...
* Add WORD textobject
* Document WORD textobject
3 years ago
Carter Snook
4304b52ff8
fix(core): stop merging array toml config values ( #1004 )
3 years ago
Blaž Hrastnik
f2b709a3c3
Merge branch 'master' into debug
3 years ago
Blaž Hrastnik
f979bdc442
Specify capacity on toggle_line_comments
3 years ago
Blaž Hrastnik
e80708eba7
Make sure document diagnostics are sorted
3 years ago
Blaž Hrastnik
6431b26a6a
Implement Selection::replace to replace a single range
...
Fixes #985
Co-authored-by: Daniel S Poulin <crimsonmage+github@gmail.com>
3 years ago
Ivan Tham
3eb829e233
Ensure coords in screen depends on char width ( #885 )
...
The issue affected files with lots of tabs at the start as well.
Fix #840
3 years ago
Kirawi
ee889aaa85
Updated tree-sitter query scopes ( #896 )
...
* updated theme scopes
variable.property -> variable.field
property -> variable.field
* updated theme scopes
* update book and themes
updated book and themes to reflect scope changes
* wip
* update more queries
* update dark_plus.toml
3 years ago
cossonleo
befecc8a9a
select smaller range on some case
3 years ago
Omnikar
45fadf6151
Add hyperlinks to fix `cargo doc` warn ( #931 )
3 years ago
Blaž Hrastnik
f3c7f20dbc
Release v0.5.0
3 years ago
Gygaxis Vainhardt
0a38983ee3
Remove three transmutes from helix-core syntax.rs ( #923 )
3 years ago
Kirawi
92c2d5d3bf
Document more of helix-core ( #904 )
3 years ago
Blaž Hrastnik
3edca7854e
completion: fully revert state before apply & insertText common prefix
3 years ago
Blaž Hrastnik
bfb6cff5a9
fix: Compose where changes.compose(empty_other)
3 years ago
Dmitry Sharshakov
6aa9838ea6
dap: support arrays as arguments
3 years ago
Blaž Hrastnik
cee7ad781e
Mark a few functions as `const`
3 years ago
Kirawi
0cb5e0b2ca
log syntax highlighting init errors ( #895 )
3 years ago
Gokul Soumya
4ee92cad19
Add treesitter textobjects ( #728 )
...
* Add treesitter textobject queries
Only for Go, Python and Rust for now.
* Add tree-sitter textobjects
Only has functions and class objects as of now.
* Fix tests
* Add docs for tree-sitter textobjects
* Add guide for creating new textobject queries
* Add parameter textobject
Only parameter.inside is implemented now, parameter.around
will probably require custom predicates akin to nvim' `make-range`
since we want to select a trailing comma too (a comma will be
an anonymous node and matching against them doesn't work similar
to named nodes)
* Simplify TextObject cell init
3 years ago
Blaž Hrastnik
182a59b552
Update to rust 1.56 + 2021 edition
3 years ago
Michael Davis
1766bdb9d4
clean up combined-injections comment ( #880 )
3 years ago
Blaž Hrastnik
83a8167402
Invert core -> dap dependency
3 years ago
Blaž Hrastnik
0a6b60085a
Merge branch 'master' into debug
3 years ago
Dmitry Sharshakov
48cb81eff1
Merge branch 'master' into debug
3 years ago
Ivan Tham
4260b31ec0
Update mdbook style and fix unreadable table head ( #806 )
...
The styles are now pulled from upstream styles, some of the changes I
submitted it back to upstream.
Fix #796
3 years ago
Midnight Exigent
eedcea7e6b
Allow `language.config` (in languages.toml) to be passed in as a toml object ( #807 )
...
* allow language.config (in languages.toml) to be passed in as a toml object
* Change config field for languages from json string to toml object
* remove indents on languages.toml config
* fix: remove patch version from serde_json import in helix-core
* Use same tree-sitter-zig as upstream/master
3 years ago
dependabot[bot]
8925fdd6f3
build(deps): bump smallvec from 1.6.1 to 1.7.0 ( #813 )
...
Bumps [smallvec](https://github.com/servo/rust-smallvec ) from 1.6.1 to 1.7.0.
- [Release notes](https://github.com/servo/rust-smallvec/releases )
- [Commits](https://github.com/servo/rust-smallvec/compare/v1.6.1...v1.7.0 )
---
updated-dependencies:
- dependency-name: smallvec
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
3 years ago
dependabot[bot]
97b24fd91e
build(deps): bump similar from 2.0.0 to 2.1.0 ( #812 )
...
Bumps [similar](https://github.com/mitsuhiko/similar ) from 2.0.0 to 2.1.0.
- [Release notes](https://github.com/mitsuhiko/similar/releases )
- [Changelog](https://github.com/mitsuhiko/similar/blob/main/CHANGELOG.md )
- [Commits](https://github.com/mitsuhiko/similar/compare/2.0.0...2.1.0 )
---
updated-dependencies:
- dependency-name: similar
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
3 years ago
Dmitry Sharshakov
d943a51e3e
editor: add Node.js debugger
3 years ago
Dmitry Sharshakov
bf53aff27d
Merge branch 'master' into debug
3 years ago
Blaž Hrastnik
2e0803c8d9
Implement 'remove_primary_selection' as Alt-,
...
This allows removing search matches from the selection
Fixes #713
3 years ago
Blaž Hrastnik
64e8f0017c
...
3 years ago
Blaž Hrastnik
d8b94ba85f
Fix broken test
3 years ago
Blaž Hrastnik
dd0b15e1f1
syntax: Properly handle injection-regex for language injections
3 years ago
dependabot[bot]
51b7f40da1
build(deps): bump similar from 1.3.0 to 2.0.0 ( #754 )
...
Bumps [similar](https://github.com/mitsuhiko/similar ) from 1.3.0 to 2.0.0.
- [Release notes](https://github.com/mitsuhiko/similar/releases )
- [Changelog](https://github.com/mitsuhiko/similar/blob/main/CHANGELOG.md )
- [Commits](https://github.com/mitsuhiko/similar/compare/1.3.0...2.0.0 )
---
updated-dependencies:
- dependency-name: similar
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
3 years ago
Blaž Hrastnik
066367c0a4
fix: Need to reset set_byte_range in case cursor_ref is reused.
3 years ago
Dmitry Sharshakov
413e477dc2
lldb: use stdio transport by default
3 years ago
Blaž Hrastnik
4ac29434cb
syntax: Add go & rust locals, improve tree-sitter error message
3 years ago
Blaž Hrastnik
585e3ce830
fix: tree-sitter-scopes would infinitely loop
3 years ago
Blaž Hrastnik
3cb95be452
Update tree-sitter to 0.20
...
0.20 includes querying improvements, we no longer have to convert
fragments to strings but can return an iterator of chunks instead.
3 years ago
Blaž Hrastnik
4d24a43651
dap: use smallvec! macro
3 years ago
Blaž Hrastnik
2a7e38a2b4
helix-core doesn't need to import serde_json
3 years ago
Dmitry Sharshakov
b42631942b
Defaults in completions, better schema
3 years ago
Dmitry Sharshakov
e315394631
Merge remote-tracking branch 'origin/master' into debug
3 years ago
Brian Shu
fa4caf7e3d
remove unsafe
3 years ago
Yusuf Bera Ertan
dc57f8dc89
feat: merge default languages.toml with user provided languages.toml, add a generic TOML value merge function ( #654 )
...
* feat: merge default languages.toml with user provided languages.toml
* refactor: use catch-all to override all other values for merge toml
* tests: add a test case for merging languages configs
* refactor: change test module name
3 years ago
Blaž Hrastnik
68bf9fdf02
Fix tests broken by the State change
3 years ago
Blaž Hrastnik
9d4c301563
Reduce State use a bit further
...
This is a legacy type that should be fully removed.
3 years ago
Dmitry Sharshakov
2ad2838a27
Fix tests
3 years ago
Dmitry Sharshakov
c7759a5aa0
Merge remote-tracking branch 'origin/master' into debug
3 years ago
Kirawi
b99db7c687
Move path util functions from helix-term to helix-core ( #650 )
3 years ago
Dmitry Sharshakov
c463142e5e
Create new debugger config format
3 years ago
Dmitry Sharshakov
56d00fa7f4
Fix tests
3 years ago
Dmitry Sharshakov
b6b99b2487
config: minor fixes
3 years ago
Dmitry Sharshakov
f55a012fb7
editor: add debug session config
3 years ago
Dmitry Sharshakov
c5b210df59
Add debug-adapter field to languages.toml
3 years ago
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
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
Nathan Vegdahl
2224a1527e
Merge branch 'master' into great_line_ending_and_cursor_range_cleanup
3 years ago
Nathan Vegdahl
9f62ad0715
Fixed last `unused` warning.
3 years ago
Nathan Vegdahl
c389f41f14
Fix one of the two remaining warnings.
...
One of them was a lot more obvious than I thought.
3 years ago
Nathan Vegdahl
220bc85821
Fix all remaining warnings in helix-core except for two.
...
I'm not sure how to address them, because they look like they
might be bugs, and code is involved. Will poke the relevant people.
3 years ago
Nathan Vegdahl
b571f28641
Remove #[allow(unused)] from helix-core, and fix unused imports.
...
Still a bunch more warnings to fix in core, but it's a start.
3 years ago
Nathan Vegdahl
e725957704
Ensure a minimum selection width on commands that need it.
3 years ago
Nathan Vegdahl
7c7be6d583
Make `Selection`'s normalize and transform methods self-consuming only.
3 years ago
Nathan Vegdahl
0ae522f3df
Clean up `Selection` to not use so many allocations.
3 years ago
Nathan Vegdahl
77a266e818
Better validation method APIs for `Range`.
...
This way they do less work, are more specific to what we actually
need, and they compose.
3 years ago
Nathan Vegdahl
d07074740b
Add `Range` methods for various kinds of validation.
3 years ago
Nathan Vegdahl
c1b0a71975
Change the `Range` type and associated functions to gap indexing.
3 years ago
Blaž Hrastnik
3007478567
fix: Correctly merge multiple selection ranges together
...
Fixes #391
3 years ago
PabloMansanet
de8745aea7
Incorporate long word commands into keymap
3 years ago
PabloMansanet
73572b7780
Add long word unit tests
3 years ago
PabloMansanet
073517a92f
Add long word motion implementation
3 years ago
Blaž Hrastnik
51162ae6b2
fix ca98210d20
3 years ago
Blaž Hrastnik
ca98210d20
fix: insert() | delete() would calculate the new insert incorrectly
...
Refs #386
3 years ago
Blaž Hrastnik
d4e1ec339e
Don't crash if diagnostics span past EOF
3 years ago
Blaž Hrastnik
1b102d5532
Extract the merge "operator" into helix-core
3 years ago
Blaž Hrastnik
44566ea812
Release 0.3.0
3 years ago
Nathan Vegdahl
a6cadddef4
Fix silly mistake in previous phantom line bug fix.
...
Fixes #381 . I was trying to change an index value that... wasn't
even an index value.
3 years ago
Nathan Vegdahl
2dba228c76
Fix highlight code splitting graphemes.
...
This resulted in phantom blank lines in files with CRLF line
endings, but could potentially have manifested with other
graphemes as well.
3 years ago
Gokul Soumya
394629ab73
Skip enclosed pairs in surround
...
Surround operations previously ignored other pairs that are
enclosed within which should be skipped. For example if the
cursor is on the `,` in `{{a},{b}}`, doing `md{` previously
would delete the `{` on the left of `a` and `}` on the right
of `b` instead of the outermost braces. This commit corrects
this behavior.
3 years ago
Nathan Vegdahl
9cbf564d08
Handle erroneously ignored case in RopeGraphemes iterator.
3 years ago
Blaž Hrastnik
7f6265ecf3
fix: crash with ctrl-c on empty file
3 years ago
Shafkath Shuhan
fd98e743e8
Handle non-UTF8 files
3 years ago
Nathan Vegdahl
38bf9c2576
Missed some items in the CRLF PR.
3 years ago
Blaž Hrastnik
9c53461429
fix: Select matching at the start of the doc could crash. Fixes #346
3 years ago
Gokul Soumya
892c80771a
Correctly identify pairs when cursor on pair
3 years ago
Gokul Soumya
86271bac18
Refactor and add tests for surround
3 years ago
Gokul Soumya
4754b2e5ae
Add more surround pair characters
3 years ago
Gokul Soumya
13648d28b9
Add surround keybinds
3 years ago
Nathan Vegdahl
f2954fa153
Flesh out the line ending utility unit tests.
3 years ago
Nathan Vegdahl
7c4fa18764
Fix clippy warnings.
3 years ago
Nathan Vegdahl
07e28802f6
Add function to get the line ending of a str slice.
...
This is needed in some places.
3 years ago
Nathan Vegdahl
3d3149e0d5
Silence clippy warning.
3 years ago
Nathan Vegdahl
e686c3e462
Merge branch 'master' of github.com:helix-editor/helix into line_ending_detection
...
Rebasing was making me manually fix conflicts on every commit, so
merging instead.
3 years ago
Nathan Vegdahl
4efd6713c5
Work on moving code over to LineEnding instead of assuming '\n'.
...
Also some general cleanup and some minor fixes along the way.
3 years ago
Nathan Vegdahl
5d22e3c4e5
Misc fixes and clean up of line ending detect code.
3 years ago
Blaž Hrastnik
e9a3245aae
Re-export unicode crates from helix_core
3 years ago
Blaž Hrastnik
9275021497
ui: prompt: Better unicode support
...
We copied over eval_movement from wezterm, that already solves most of
our problems. self.cursor is now byte-based.
3 years ago
Jan Hrastnik
8634e04a31
added the line_end helper function
3 years ago
Jan Hrastnik
701eb0dd68
changed some hardcoded newlines, removed a else if in line_ending.rs
3 years ago
wojciechkepka
6825e19509
Only reconfiure highlights when setting theme
3 years ago
wojciechkepka
ce97a2f05f
Add ability to change theme on editor
3 years ago
Jan Hrastnik
cdd9347457
Merge remote-tracking branch 'origin/master' into line_ending_detection
3 years ago
Jan Hrastnik
97323dc2f9
ran cargo fmt
3 years ago
Jan Hrastnik
ecb884db98
added get_line_ending from pr comment
3 years ago
Benoît CORTIER
03d1ca7b0a
cargo: add more metadata to manifests
3 years ago
Benoît CORTIER
db5bdf4f2d
Run cargo-diet
...
cargo-diet is a helper for computing the optimal `include` directives
for Cargo.toml manifests.
https://github.com/the-lean-crate/cargo-diet
3 years ago
Benoît CORTIER
b48054f3ee
cargo: add version to local dependencies
...
First step towards enabling us to publish on crates.io.
See: https://github.com/helix-editor/helix/issues/42
3 years ago
Benoît CORTIER
b0522239e7
Update ropey dependency to 1.3
3 years ago
Wojciech Kępka
41b07486ad
Fix expansion of `~` ( #284 )
...
* Fix expansion of `~`, dont use directory relative to cwd.
* Add `expand_tilde`
* Bring back `canonicalize_path`, use `expand_tilde` to `normalize`
* Make `:open ~` completion work
* Fix clippy
* Fold home dir into tilde in Document `realitve_path`
3 years ago
Jan Hrastnik
8bccd6df30
applied changes from pr review
3 years ago
Jan Hrastnik
a4f5a0134e
trying out line ending helper functions in commands.rs
3 years ago
Jan Hrastnik
a9a718c3ca
added some tests and a line_ending helper function in document.rs
3 years ago
Jan Hrastnik
e4849f41be
fix typo
3 years ago
Jan Hrastnik
9c419fe05c
added more changes from pr review for line_ending_detection
3 years ago
Jan Hrastnik
5eb6918392
resolved conflict in rebase
3 years ago
Jan Hrastnik
17f69a03e0
ran cargo clippy and cargo fmt
3 years ago
Jan Hrastnik
3756c21bae
rebase on branch line_ending_detection
3 years ago
Benoît CORTIER
6bdf609caa
Remove RwLock for registers
...
Registers are stored inside `Editor` and accessed without `RwLock`.
To work around ownership, I added a sister method to `Editor::current`:
`Editor::current_with_context`. I tried to modify `Editor::current`
directly but it's used at a lot of places so I reverted into this for
now at least.
3 years ago
Nathan Vegdahl
0a5580aa21
Address PR comments.
...
- Move char functions into their own module under helix_core.
- Use matches!() macro where appropriate.
- Use a static lifetime on indent_unit() now that we can.
3 years ago
Ivan Tham
1bda454149
Add ctrl-w for prompt
3 years ago
dependabot[bot]
e4b3a666d2
Bump once_cell from 1.7.2 to 1.8.0 ( #255 )
...
Bumps [once_cell](https://github.com/matklad/once_cell ) from 1.7.2 to 1.8.0.
- [Release notes](https://github.com/matklad/once_cell/releases )
- [Changelog](https://github.com/matklad/once_cell/blob/master/CHANGELOG.md )
- [Commits](https://github.com/matklad/once_cell/compare/v1.7.2...v1.8.0 )
---
updated-dependencies:
- dependency-name: once_cell
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
3 years ago
Blaž Hrastnik
ae5ecfdf66
Release v0.2.0
3 years ago
Wojciech Kępka
4b6aff8c66
Use `runtime` dir when defaulting to executable location
3 years ago
Wojciech Kępka
4a40e935de
Make `runtime_dir` private
3 years ago
Wojciech Kępka
716067ba05
Add more ways to detect runtime directory
3 years ago
Blaž Hrastnik
1665bac1b6
Fix broken test
3 years ago
Blaž Hrastnik
278361a086
Only auto-format for certain languages
...
Fixes #53
Fixes #207
3 years ago
Jakub Bartodziej
69fe46a122
Add :earlier and :later commands that can be used to navigate the full edit history. ( #194 )
...
* Disable deleting from an empty buffer which can cause a crash.
* Improve on the fix for deleting from the end of the buffer.
* Clean up leftover log.
* Avoid theoretical underflow.
* Implement :before which accepts a time interval and moves the editor to
the closest history state to the commit of the current time minus that
interval. Current time is now by default, or the commit time if :before
has just been used.
* Add :earlier an :later commands that can move through
the edit history and retrieve changes hidded by undoing
and commiting new changes. The commands accept a number
of steps or a time period relative to the currrent change.
* Fix clippy lint error.
* Remove the dependency on parse_duration, add a custom parser instead.
* Fix clippy errors.
* Make helix_core::history a public module.
* Use the helper for getting the current document and view.
* Handled some PR comments.
* Fix the logic in :later n.
Co-authored-by: Ivan Tham <pickfire@riseup.net>
* Add an alias for :earlier.
Co-authored-by: Ivan Tham <pickfire@riseup.net>
* Add an alias for later.
Co-authored-by: Ivan Tham <pickfire@riseup.net>
* Run cargo fmt.
* Add some tests for earlier and later.
* Add more tests and restore the fix for later that diappeared somehow.
* Use ? instead of a match on an option.
Co-authored-by: Ivan Tham <pickfire@riseup.net>
* Rename to UndoKind.
* Remove the leftover match.
* Handle a bunch of review comments.
* More systemd.time compliant time units and additional description for the new commands.
* A more concise rewrite of the time span parser using ideas from PR discussion.
* Replace a match with map_err().
Co-authored-by: Ivan Tham <pickfire@riseup.net>
Co-authored-by: Jakub Bartodziej <jqb@google.com>
Co-authored-by: Ivan Tham <pickfire@riseup.net>
3 years ago
PabloMansanet
86af55c379
Movement fixes, refactor and unit test suite ( #217 )
...
* Add convenience/clarity wrapper for Range initialization
* Test horizontal moves
* Add column jumping tests
* Add failing movement conditions for multi-word moves
* Refactor skip_over_next
* Add complex forward movement unit tests
* Add strict whitespace checks and edge case tests
* Restore formatting
* Remove unused function
* Add empty test case for deletion and fix nth_prev_word_boundary
* Add tests for backward motion
* Refactor word movement
* Address review comments and finish refactoring backwards move
* Finish unit test suite
* Fmt pass
* Fix lint erors
* Clean up diff restoring bad 'cargo fmt' actions
* Simplify movement closures (thanks Pickfire)
* Fmt pass
* Replace index-based movement with iterator based movement, ensuring that each move incurs a single call to the RopeSlice API
* Break down tuple function
* Extract common logic to all movement functions
* Split iterator helpers away into their own module
* WIP reducing clones
* Operate on spans
* WIP simplifying iterators
* Simplify motion helpers
* Fix iterator
* Fix all unit tests
* Refactor and simplify
* Simplify fold
3 years ago
notoria
1b14e9a19a
Downgrade `unicode-segmentation`
3 years ago
Ivan Tham
7cc13fefe9
Derive debug without feature
...
Note that this also removed those `finish_non_exhaustive()`.
3 years ago
notoria
1a3a924634
Implement Debug for data structure as a feature
3 years ago
Blaž Hrastnik
aebdef8257
Reuse a cursor from the pool if available ( fixes #202 )
3 years ago
Ivan Tham
5e2ba28e0e
Fix panic on ctrl-w empty document
3 years ago
Wojciech Kępka
c978d811d9
Cleanup find_first_non_whitespace_char funcs
3 years ago
Wojciech Kępka
48df05b16d
commands: Add goto first non-whitespace char of line
3 years ago
Kirawi
b873fb9897
Fix Unicode ( #135 )
...
* init
* wip
* wip
* fix unicode break
* fix unicode break
* Update helix-core/src/transaction.rs
Co-authored-by: Benoît Cortier <benoit.cortier@fried-world.eu>
* clippy
* fix
* add changes
* added test
* wip
* wip
* wip
* wip
* fix
* fix view
* fix #88
Co-authored-by: Benoît Cortier <benoit.cortier@fried-world.eu>
3 years ago
Benoît CORTIER
68affa3c59
Implement register selection
...
User can select register to yank into with the " command.
A new state is added to `Editor` and `commands::Context` structs.
This state is managed by leveraging a new struct `RegisterSelection`.
3 years ago
Blaž Hrastnik
8d6fad4cac
lsp: Provide workspace root on client.initialize()
3 years ago
Blaž Hrastnik
f48a60b8e2
Release 0.0.10
3 years ago
ahkrr
e2d780f993
fix: 2 panics while setting style + off by 1
...
The panics would occur because set_style
would draw outside of the the surface.
Both occured using `find_prev` or `till_prev`
In my case the first panic! would appear
in a terminal with around 80 columns
in helix/README.md going to the end of the file
with `geglf(`
the second with `geglfX`
The off by one fix ensures that `find_nth_prev`
starts at the first character to the left
3 years ago
Ethan Bodzioney
843c2cdebd
Install instructions and version number corrections ( #148 )
...
* Add MacOS install instructions
* Change version name argument
When using the -V command to get the version you are given 'helix-term x.x.x', I changed this to just helix as it makes more sense.
* Fixed version number
* Fixed version number
* Fixed version number
* Fixed version number
* Fixed version number
* Fixed version number
3 years ago
Benoît CORTIER
8a29086c1a
Fix panic when moving over unicode punctuation
...
`is_ascii_punctuation` will only work for ASCII punctuations, and when
we have unicode punctuation (or other) we jump into the `unreachable`.
This patch fallback into categorizing everything in this branch as
`Unknown`.
Fixes https://github.com/helix-editor/helix/issues/123
https://github.com/helix-editor/helix/pull/135 : add better support for
unicode categories.
3 years ago
Ivan Tham
df80f3c966
Add test for prev word
3 years ago
Ivan Tham
40744ce835
Add ctrl-w in insert mode
...
It seemed to panic when I pressed too many times, but that is from
lsp side.
3 years ago
Brian Dawn
5463a436a8
Return an error if we request an embedded file that does not exist.
...
This makes the load_runtime_file function behave like the non-embedded
one.
3 years ago
Brian Dawn
e09b0f4eff
Add a smoke test around loading runtime files.
...
This test makes sure we can read some amount of data from the runtime folder.
3 years ago
Brian Dawn
f3db12e240
Simplify the load_runtime_file code.
...
Reduce the number of feature switches for the embed_runtime feature.
3 years ago
Brian Dawn
676719b361
Simplify creating pathbufs.
...
Co-authored-by: Ivan Tham <pickfire@riseup.net>
3 years ago
Brian Dawn
ae105812d6
Apply suggestions from code review
...
Co-authored-by: Ivan Tham <pickfire@riseup.net>
3 years ago
Brian Dawn
255598a2cb
Make rust-embed optionally included based on the embed_runtime feature.
3 years ago
Brian Dawn
62d181de78
Provide a feature flag to be able to embed the runtime folder.
...
These changes provide a new feature flag "embed_runtime" that when
enabled and built in release mode will embed the runtime folder into the
resulting binary.
3 years ago
ahkrr
444cd0b068
fix: make find_prev_char and till_prev_char work
...
Bevore this PR `commands::find_prev_char` and `commands::till_prev_char` were triggerable through keys
but `seach::find_nth_next()` was hardcoded in `_find_char`.
The passed `fn` was nerver used. With this PR the passed `fn` is used.
The change in search.rs resolves an off by one error in the behivor of `find_nth_prev`
3 years ago
Ivan Tham
6254720f53
Add unreachable context
...
Better error for #123
3 years ago
notoria
2bb71a829e
Don't panic on empty file/buffer ( #108 )
3 years ago
Kirawi
c17dcb8633
Fixing Multiple Panics ( #121 )
...
* init
* wip
* wip
3 years ago
Blaž Hrastnik
06d8d3f55f
Try to detect language when document file path is set
...
Fixes #91
4 years ago
notoria
8af5a9a5cf
Remove swapfile
4 years ago
notoria
f76f44c8af
Convert byte index to char index for `find`
4 years ago
Blaž Hrastnik
74e4ac8d49
Merge pull request #77 from notoria/match_brackets
...
Fix match_brackets::find
4 years ago
notoria
4fe654cf9a
Fix match_brackets::find
4 years ago
Ivan Tham
d664d1dec0
Default log file to cache
4 years ago
Ivan Tham
f5f46b1fed
Separate document history into Cell
...
As history is used separately from the rest of the edits, separating it
can avoid needless borrowing and cloning. But one need to be aware later.
4 years ago
Blaž Hrastnik
f4560cb68a
Better fix for w/e that also covers `ia<esc>we`/`ia<esc>wb`
4 years ago
Blaž Hrastnik
0851110d10
f/t: Check if at bounds before searching, refs #43 , closes #37
4 years ago
Blaž Hrastnik
3ace581191
Fix panics when triggering w or e on the last char of the line
...
Closes #32
4 years ago
Blaž Hrastnik
c0264b9f7f
fix: Don't allow moving past last line, fixes #30 , #24
...
Off by 1 error
4 years ago
Blaž Hrastnik
2cc30cd07c
Categorize _ as a word char, not punctuation
4 years ago
Blaž Hrastnik
17e9386388
Allow moving to EOL byte, also fixes #15
4 years ago
Blaž Hrastnik
138787f76e
Drop clap for pico-args
...
We barely have any flags so it's not worth the compilation time or
binary size to use clap.
4 years ago
Blaž Hrastnik
6460501a44
Update architecture.md
4 years ago
Blaž Hrastnik
094203c74e
Update deps, introduce the new tree-sitter lifetimes
4 years ago
Blaž Hrastnik
0e5b421646
When calculating a new selection, we need to take newly inserted text into account.
4 years ago
Blaž Hrastnik
4a9d1163e0
Hacky way to specify indent scopes per language via toml configs.
...
Can't do it via a scm query nicely because it returns an iterator over
all the matches, whereas we want to traverse the tree ourselves.
Can't extract the pattern data from a parsed query either.
Oh well, toml files for now.
4 years ago
Blaž Hrastnik
5cbb4efa6d
Add the LICENSE file.
4 years ago
Blaž Hrastnik
0190fee1c2
Fix indent test, we need to use the in-tree runtime dir.
4 years ago
Blaž Hrastnik
cd1754f783
Fix runtime dir lookup.
4 years ago
Blaž Hrastnik
1f2d87cb95
Make the config dir locator work on Windows.
4 years ago
Blaž Hrastnik
0f77f543e5
Determine runtime dir based on executable location or env override.
4 years ago
Blaž Hrastnik
5954dafdbc
Indent array and tuple lists too.
4 years ago
Blaž Hrastnik
6c705f09e8
Lint
4 years ago
Blaž Hrastnik
7c915dc065
Add the :new command, don't crash if saving without filename.
4 years ago
Blaž Hrastnik
f8844c6811
Implement pair expansion when pressing new line between bracket pairs.
...
From:
{|}
To:
{
|
}
4 years ago
Blaž Hrastnik
fd4fd12fa3
clippy lint
4 years ago
Blaž Hrastnik
28c167d71d
doc: Be smarter about calculating modified status.
...
This way edit -> undo will properly show up as unmodified.
4 years ago
Blaž Hrastnik
7e9ea30a0b
auto_pairs: move if cursor, extend if selection.
4 years ago
Blaž Hrastnik
5edb374237
And some more indent patterns.
4 years ago
Blaž Hrastnik
9e6c8c2a5a
Rust: add a few more scopes to indent.
4 years ago
Blaž Hrastnik
9445b24b88
Simplify calculate_indentation.
4 years ago
Blaž Hrastnik
95dd55ba94
Fix overlap calculation.
4 years ago
Blaž Hrastnik
73f4abbb37
N as extend with search (for now, N should be search_prev).
4 years ago
Blaž Hrastnik
35b4fe4cd0
Fix range.overlap()
4 years ago
Blaž Hrastnik
c1e5733b02
Remove the path specifier.
4 years ago
Blaž Hrastnik
71c06c11cb
Import tree sitter queries.
4 years ago
Blaž Hrastnik
bc4e54c0c4
Load config files from ~/.config/helix, fallback to defaults.
4 years ago
Blaž Hrastnik
f0d49d3ca4
hack: make queries load relative to source dir for now.
...
We want to provide a runtime dir later on.
4 years ago
Blaž Hrastnik
e8298a398c
Fix selection rendering, it would be off by 1 if reverse.
4 years ago
Blaž Hrastnik
63e602bda6
Fix issues with "enum A {|}" <Enter> indent calculation.
4 years ago
Blaž Hrastnik
9dfd6f6bbc
clippy lint
4 years ago
Blaž Hrastnik
f00cb15137
core: Improve changeset composition behavior.
...
It would fail to combine with an empty set.
4 years ago
Blaž Hrastnik
015fd2ffa2
pairs: Use token utf8 lengths instead of 1.
4 years ago
Blaž Hrastnik
59a0fc7b59
w, b, e: Match kakoune's behavior in selecting by default.
...
I initially preferred only moving the cursor, but selecting the whole
word is a lot nicer for things like wd (instead of vwd).
4 years ago
Blaž Hrastnik
cc058ad78f
Simplify some code.
4 years ago
Blaž Hrastnik
9eaef6e333
Fully drop State references.
4 years ago
Blaž Hrastnik
742b3a709f
Store intra-files jumps (goto) on the jumplist.
4 years ago
Blaž Hrastnik
1d96cbfbd2
Transaction: Add a changes_iter() that can convert back to a list of Changes
4 years ago
Blaž Hrastnik
a74ff6bc03
Transaction: need to consume insert | delete properly.
4 years ago
Blaž Hrastnik
b52474cf66
clippy lint
4 years ago
Blaž Hrastnik
ad3325db8e
minor: Remove a few unwraps.
4 years ago
Blaž Hrastnik
8b28bf2533
Fix broken test.
4 years ago
Blaž Hrastnik
e3c4edae32
Add the machinery to load syntax config from TOML.
...
It's embedded into the binary at build time for now, but it's progress.
4 years ago
Blaž Hrastnik
9a36d2c2a8
wip: Hooks & trigger characters for completion/signature_help.
4 years ago
Blaž Hrastnik
06aca7691c
clippy lint
4 years ago
Blaž Hrastnik
d0530fb839
Fix a scrolling crash where it would jump past the end of the buffer.
4 years ago
Blaž Hrastnik
73c92a0bc1
Implement m / match_brackets (using tree sitter).
4 years ago
Blaž Hrastnik
bd607b4cbd
Provide a capacity on Selection::new's normalize.
4 years ago
Blaž Hrastnik
5e6716c89c
Add tab_width and indent_unit config.
4 years ago
Blaž Hrastnik
cbcacb1063
Merge some imports.
4 years ago
Blaž Hrastnik
c4792efead
clippy lints
4 years ago
Blaž Hrastnik
798dbd27c5
Selection: fail early if new() is called with no ranges.
4 years ago
Blaž Hrastnik
71999cce43
Implement auto-pairs behavior for open and close.
4 years ago
Blaž Hrastnik
f29f01858d
Implement iter() and len() directly on Selection.
4 years ago
Blaž Hrastnik
c331721565
Finish hiding doc.state / State as an implementation detail.
4 years ago
Blaž Hrastnik
59e6024186
Remove State from a few more signatures.
4 years ago
Blaž Hrastnik
dbcc099f48
Move things out of state.rs.
4 years ago
Blaž Hrastnik
8eaf9a432d
Make Transaction::change only rely on the rope.
4 years ago
Blaž Hrastnik
4f77d80e74
Clippy lint
4 years ago
Blaž Hrastnik
081e0ae8ae
syntax: highlight_iter always returns Ok()
4 years ago
Blaž Hrastnik
71f899cb5b
syntax: Highlight using ropes, avoiding dumping whole doc to string.
4 years ago
Blaž Hrastnik
dd91090a1a
Implement keep_selections (filter selections on regex).
4 years ago
Blaž Hrastnik
87e3cd3df2
ui: Render diagnostic errors in sideline.
4 years ago
Blaž Hrastnik
9c55b3e306
state.rs cleanup
4 years ago
Blaž Hrastnik
bb87b08fc9
Configure language servers via LanguageConfiguration.
4 years ago
Blaž Hrastnik
1cf887dea9
Cleanup: use doc.selection() instead of doc.state.selection().
4 years ago
Blaž Hrastnik
3445abf88e
syntax: Hide the TSParser internally, borrowing when needed.
4 years ago
Blaž Hrastnik
b7dd7310c4
syntax: Reuse parser instances. highlight_iter() no longer needs &mut.
4 years ago
Blaž Hrastnik
9dcfe25e4a
Use diagnostic.severity to distinguish between error colors.
4 years ago
Blaž Hrastnik
4acf301022
Implement the f/t/F/T find/till family of commands.
4 years ago
Blaž Hrastnik
62c991230f
find-till (f) prototype, on_next_key mode implementation.
4 years ago
Blaž Hrastnik
90f9cd6d62
search: draft f/t
4 years ago
Blaž Hrastnik
a16c6e2585
clippy lints
4 years ago
Blaž Hrastnik
2c9b02039b
commands: Implement join_selections.
4 years ago
Blaž Hrastnik
ad58286dc7
graphemes: fix nth_prev_grapheme_boundary calculation.
4 years ago
Blaž Hrastnik
01907b3497
commands: Implement count for a few more commands.
4 years ago
Blaž Hrastnik
6bd16a7320
graphemes: Optimize nth_next/nth_prev operation.
...
It's used a lot more than it used to in position calculation. Instead of
throwing away state between boundary calculation, reuse it.
4 years ago
Blaž Hrastnik
f118e7580f
Improve coords_at_pos & pos_at_coords, test with graphemes.
4 years ago
Blaž Hrastnik
87a6d4e736
minor: Simplify some code.
4 years ago
Blaž Hrastnik
6cfb1acb9d
commands: Implement expand_selection.
4 years ago
Blaž Hrastnik
33c67f1388
commands: add * as selection search.
4 years ago
Blaž Hrastnik
9132c6a591
Make some Document fields read-only.
4 years ago
Blaž Hrastnik
8c82f8f140
indent: use_list indentation, fix indentation bug on open_below
...
use std::{
time::Duration // <- pressing `o` here would use }'s indent instead of prev line
}
4 years ago
Blaž Hrastnik
7a1ff5e45f
commands: Wire up toggle comments as ctrl-c
4 years ago
Blaž Hrastnik
4ab5631d65
more lints
4 years ago
Blaž Hrastnik
d0791e0f98
core: Implement comment toggling module.
4 years ago
Blaž Hrastnik
c9dd1c930e
treewide: &RopeSlice -> RopeSlice. It's Copy so no reason to pass by ref
4 years ago
Blaž Hrastnik
af55ebd002
transaction: Also modify map_pos to work with insert|delete order.
4 years ago
Blaž Hrastnik
9cac44c7c0
minor changes
4 years ago
Blaž Hrastnik
d8bc19f715
Update deps, switch tendril over to crates.io
4 years ago
Blaž Hrastnik
9821c4dd3b
Optimize Changeset::is_empty()
...
Checked the ASM output for these three options:
pub enum Operation {
/// Move cursor by n characters.
Retain(usize),
/// Delete n characters.
Delete(usize),
/// Insert text at position.
Insert(String),
}
pub struct A {
changes: Vec<Operation>,
len: usize,
}
impl A {
pub fn is_empty1(&self) -> bool {
match self.changes.as_slice() {
[] => true,
[Operation::Retain(_)] => true,
_ => false,
}
}
/// `true` when the set is empty.
pub fn is_empty2(&self) -> bool {
let len = self.changes.len();
len == 0
|| (
len == 1
&& self.changes[0] == Operation::Retain(self.len)
)
}
pub fn is_empty3(&self) -> bool {
match self.changes.as_slice() {
[] | [Operation::Retain(_)] => true,
_ => false
}
}
}
4 years ago
Blaž Hrastnik
b0b5451c38
Since insert preceedes deletes, follow that ordering in Transaction::changes.
...
Produces the same output but will take the happy path.
4 years ago
Blaž Hrastnik
b4312c9492
transaction: Use builder methods to generate compact changesets.
4 years ago
Blaž Hrastnik
19fb4ed835
transaction: Merge consecutive inserts on compose.
4 years ago
Blaž Hrastnik
65893a2cbc
fix test
4 years ago
Blaž Hrastnik
239db79834
Finally: Retain horizontal position when moving vertically.
4 years ago
Blaž Hrastnik
a924ad2885
simplify.
4 years ago
Blaž Hrastnik
2bea5db7bd
commands: Implement select_on_matches.
4 years ago
Blaž Hrastnik
7c99ff58fd
nix: include rust-src so rust-analyzer works correctly.
4 years ago
Blaž Hrastnik
22e1692adc
indent: Fix edge cases, refactor test.
4 years ago
Blaž Hrastnik
777a80917d
Address clippy lints.
4 years ago
Blaž Hrastnik
7d41550a23
indent: refactor logic to be more correct.
...
Thanks to atom-sane-indentation, nvim-treesitter and tree-sitter-indent.el
for inspiration.
4 years ago
Blaž Hrastnik
a7869c728c
wip
4 years ago
Blaž Hrastnik
cc6bdf8f66
Text change generation, RPC call handling.
4 years ago
Blaž Hrastnik
f5981f72c2
Introduce Selection::point.
4 years ago
Blaž Hrastnik
efc5aa2016
Simplify old_state handling.
4 years ago
Blaž Hrastnik
c0e17dd324
Fix undo/redo not updating the syntax tree.
4 years ago
Blaž Hrastnik
b39849dde1
Refactor: Document type as a wrapper around barebones State.
4 years ago
Blaž Hrastnik
ef5e5f9296
state.version tracking
4 years ago
Blaž Hrastnik
49254d7180
Total mess but it works: diagnostic marking.
4 years ago