PabloMansanet
73572b7780
Add long word unit tests
2021-06-30 00:56:19 +09:00
PabloMansanet
073517a92f
Add long word motion implementation
2021-06-30 00:56:19 +09:00
Blaž Hrastnik
51162ae6b2
fix ca98210d20
2021-06-28 18:05:20 +09:00
Blaž Hrastnik
ca98210d20
fix: insert() | delete() would calculate the new insert incorrectly
...
Refs #386
2021-06-28 17:49:34 +09:00
Blaž Hrastnik
d4e1ec339e
Don't crash if diagnostics span past EOF
2021-06-28 14:50:35 +09:00
Blaž Hrastnik
1b102d5532
Extract the merge "operator" into helix-core
2021-06-27 23:28:22 +09:00
Blaž Hrastnik
44566ea812
Release 0.3.0
2021-06-27 13:27:47 +09:00
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.
2021-06-26 14:26:18 +09:00
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.
2021-06-26 11:09:50 +09:00
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.
2021-06-24 13:02:56 +09:00
Nathan Vegdahl
9cbf564d08
Handle erroneously ignored case in RopeGraphemes iterator.
2021-06-24 10:04:03 +09:00
Blaž Hrastnik
7f6265ecf3
fix: crash with ctrl-c on empty file
2021-06-24 01:38:02 +09:00
Shafkath Shuhan
fd98e743e8
Handle non-UTF8 files
2021-06-23 15:40:27 +09:00
Nathan Vegdahl
38bf9c2576
Missed some items in the CRLF PR.
2021-06-23 12:43:09 +09:00
Blaž Hrastnik
9c53461429
fix: Select matching at the start of the doc could crash. Fixes #346
2021-06-23 12:27:38 +09:00
Gokul Soumya
892c80771a
Correctly identify pairs when cursor on pair
2021-06-22 14:27:51 +09:00
Gokul Soumya
86271bac18
Refactor and add tests for surround
2021-06-22 14:27:51 +09:00
Gokul Soumya
4754b2e5ae
Add more surround pair characters
2021-06-22 14:27:51 +09:00
Gokul Soumya
13648d28b9
Add surround keybinds
2021-06-22 14:27:51 +09:00
Nathan Vegdahl
f2954fa153
Flesh out the line ending utility unit tests.
2021-06-21 12:56:42 -07:00
Nathan Vegdahl
7c4fa18764
Fix clippy warnings.
2021-06-21 12:02:44 -07:00
Nathan Vegdahl
07e28802f6
Add function to get the line ending of a str slice.
...
This is needed in some places.
2021-06-21 10:29:29 -07:00
Nathan Vegdahl
3d3149e0d5
Silence clippy warning.
2021-06-20 16:13:59 -07:00
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.
2021-06-20 16:09:14 -07:00
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.
2021-06-20 15:33:02 -07:00
Nathan Vegdahl
5d22e3c4e5
Misc fixes and clean up of line ending detect code.
2021-06-20 00:40:41 -07:00
Blaž Hrastnik
e9a3245aae
Re-export unicode crates from helix_core
2021-06-20 16:38:58 +09:00
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.
2021-06-20 16:38:58 +09:00
Jan Hrastnik
8634e04a31
added the line_end helper function
2021-06-20 02:22:10 +02:00
Jan Hrastnik
701eb0dd68
changed some hardcoded newlines, removed a else if in line_ending.rs
2021-06-20 01:24:36 +02:00
wojciechkepka
6825e19509
Only reconfiure highlights when setting theme
2021-06-20 00:07:13 +09:00
wojciechkepka
ce97a2f05f
Add ability to change theme on editor
2021-06-20 00:07:13 +09:00
Jan Hrastnik
cdd9347457
Merge remote-tracking branch 'origin/master' into line_ending_detection
2021-06-19 14:51:53 +02:00
Jan Hrastnik
97323dc2f9
ran cargo fmt
2021-06-19 14:05:11 +02:00
Jan Hrastnik
ecb884db98
added get_line_ending from pr comment
2021-06-19 14:03:14 +02:00
Benoît CORTIER
03d1ca7b0a
cargo: add more metadata to manifests
2021-06-19 10:04:59 +09:00
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
2021-06-19 10:04:59 +09:00
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
2021-06-19 10:04:59 +09:00
Benoît CORTIER
b0522239e7
Update ropey dependency to 1.3
2021-06-18 22:56:36 +09:00
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`
2021-06-18 15:19:34 +09:00
Jan Hrastnik
8bccd6df30
applied changes from pr review
2021-06-17 13:49:50 +02:00
Jan Hrastnik
a4f5a0134e
trying out line ending helper functions in commands.rs
2021-06-16 17:13:41 +02:00
Jan Hrastnik
a9a718c3ca
added some tests and a line_ending helper function in document.rs
2021-06-16 17:11:16 +02:00
Jan Hrastnik
e4849f41be
fix typo
2021-06-16 17:09:03 +02:00
Jan Hrastnik
9c419fe05c
added more changes from pr review for line_ending_detection
2021-06-16 17:08:46 +02:00
Jan Hrastnik
5eb6918392
resolved conflict in rebase
2021-06-16 17:05:14 +02:00
Jan Hrastnik
17f69a03e0
ran cargo clippy and cargo fmt
2021-06-16 17:00:30 +02:00
Jan Hrastnik
3756c21bae
rebase on branch line_ending_detection
2021-06-16 17:00:21 +02:00
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.
2021-06-15 23:01:56 +08:00
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.
2021-06-14 18:32:23 -07:00
Ivan Tham
1bda454149
Add ctrl-w for prompt
2021-06-15 01:06:53 +09:00
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>
2021-06-14 17:46:12 +09:00
Blaž Hrastnik
ae5ecfdf66
Release v0.2.0
2021-06-13 22:35:13 +09:00
Wojciech Kępka
4b6aff8c66
Use runtime
dir when defaulting to executable location
2021-06-12 17:26:41 +08:00
Wojciech Kępka
4a40e935de
Make runtime_dir
private
2021-06-12 17:26:41 +08:00
Wojciech Kępka
716067ba05
Add more ways to detect runtime directory
2021-06-12 17:26:41 +08:00
Blaž Hrastnik
1665bac1b6
Fix broken test
2021-06-12 10:24:48 +09:00
Blaž Hrastnik
278361a086
Only auto-format for certain languages
...
Fixes #53
Fixes #207
2021-06-12 10:20:37 +09:00
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>
2021-06-11 22:06:13 +09:00
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
2021-06-11 21:57:07 +09:00
notoria
1b14e9a19a
Downgrade unicode-segmentation
2021-06-10 22:00:08 +09:00
Ivan Tham
7cc13fefe9
Derive debug without feature
...
Note that this also removed those `finish_non_exhaustive()`.
2021-06-10 22:00:08 +09:00
notoria
1a3a924634
Implement Debug for data structure as a feature
2021-06-10 22:00:08 +09:00
Blaž Hrastnik
aebdef8257
Reuse a cursor from the pool if available ( fixes #202 )
2021-06-10 12:49:34 +09:00
Ivan Tham
5e2ba28e0e
Fix panic on ctrl-w empty document
2021-06-08 23:08:08 +09:00
Wojciech Kępka
c978d811d9
Cleanup find_first_non_whitespace_char funcs
2021-06-08 17:22:37 +09:00
Wojciech Kępka
48df05b16d
commands: Add goto first non-whitespace char of line
2021-06-08 17:22:37 +09:00
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>
2021-06-08 13:20:15 +09:00
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`.
2021-06-07 21:52:09 +09:00
Blaž Hrastnik
8d6fad4cac
lsp: Provide workspace root on client.initialize()
2021-06-07 21:32:01 +09:00
Blaž Hrastnik
f48a60b8e2
Release 0.0.10
2021-06-07 09:42:15 +09:00
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
2021-06-07 09:15:08 +09:00
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
2021-06-07 09:14:06 +09:00
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.
2021-06-07 09:12:01 +09:00
Ivan Tham
df80f3c966
Add test for prev word
2021-06-06 21:30:18 +09:00
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.
2021-06-06 21:30:18 +09:00
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.
2021-06-06 10:49:17 +09:00
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.
2021-06-06 10:49:17 +09:00
Brian Dawn
f3db12e240
Simplify the load_runtime_file code.
...
Reduce the number of feature switches for the embed_runtime feature.
2021-06-06 10:49:17 +09:00
Brian Dawn
676719b361
Simplify creating pathbufs.
...
Co-authored-by: Ivan Tham <pickfire@riseup.net>
2021-06-06 10:49:17 +09:00
Brian Dawn
ae105812d6
Apply suggestions from code review
...
Co-authored-by: Ivan Tham <pickfire@riseup.net>
2021-06-06 10:49:17 +09:00
Brian Dawn
255598a2cb
Make rust-embed optionally included based on the embed_runtime feature.
2021-06-06 10:49:17 +09:00
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.
2021-06-06 10:49:17 +09:00
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`
2021-06-06 00:01:16 +09:00
Ivan Tham
6254720f53
Add unreachable context
...
Better error for #123
2021-06-05 20:18:27 +08:00
notoria
2bb71a829e
Don't panic on empty file/buffer ( #108 )
2021-06-05 13:00:43 +09:00
Kirawi
c17dcb8633
Fixing Multiple Panics ( #121 )
...
* init
* wip
* wip
2021-06-05 12:49:19 +09:00
Blaž Hrastnik
06d8d3f55f
Try to detect language when document file path is set
...
Fixes #91
2021-06-04 11:03:40 +09:00
notoria
8af5a9a5cf
Remove swapfile
2021-06-04 10:30:14 +09:00
notoria
f76f44c8af
Convert byte index to char index for find
2021-06-04 10:00:22 +09:00
Blaž Hrastnik
74e4ac8d49
Merge pull request #77 from notoria/match_brackets
...
Fix match_brackets::find
2021-06-03 22:13:48 +09:00
notoria
4fe654cf9a
Fix match_brackets::find
2021-06-03 10:35:17 +02:00
Ivan Tham
d664d1dec0
Default log file to cache
2021-06-03 10:15:17 +08:00
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.
2021-06-02 23:47:50 +08:00
Blaž Hrastnik
f4560cb68a
Better fix for w/e that also covers ia<esc>we
/ia<esc>wb
2021-06-02 14:57:43 +09:00
Blaž Hrastnik
0851110d10
f/t: Check if at bounds before searching, refs #43 , closes #37
2021-06-02 13:20:27 +09:00
Blaž Hrastnik
3ace581191
Fix panics when triggering w or e on the last char of the line
...
Closes #32
2021-06-02 13:19:40 +09:00
Blaž Hrastnik
c0264b9f7f
fix: Don't allow moving past last line, fixes #30 , #24
...
Off by 1 error
2021-06-02 13:19:40 +09:00
Blaž Hrastnik
2cc30cd07c
Categorize _ as a word char, not punctuation
2021-05-31 21:09:17 +09:00
Blaž Hrastnik
17e9386388
Allow moving to EOL byte, also fixes #15
2021-05-31 17:08:19 +09:00
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.
2021-05-31 17:07:43 +09:00
Blaž Hrastnik
6460501a44
Update architecture.md
2021-05-30 17:52:46 +09:00
Blaž Hrastnik
094203c74e
Update deps, introduce the new tree-sitter lifetimes
2021-05-28 00:00:51 +09:00
Blaž Hrastnik
0e5b421646
When calculating a new selection, we need to take newly inserted text into account.
2021-05-15 10:50:36 +09:00
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.
2021-05-14 19:21:46 +09:00
Blaž Hrastnik
5cbb4efa6d
Add the LICENSE file.
2021-05-11 01:44:00 +09:00
Blaž Hrastnik
0190fee1c2
Fix indent test, we need to use the in-tree runtime dir.
2021-05-10 17:57:17 +09:00
Blaž Hrastnik
cd1754f783
Fix runtime dir lookup.
2021-05-10 17:37:04 +09:00
Blaž Hrastnik
1f2d87cb95
Make the config dir locator work on Windows.
2021-05-10 16:21:55 +09:00
Blaž Hrastnik
0f77f543e5
Determine runtime dir based on executable location or env override.
2021-05-10 01:02:53 +09:00
Blaž Hrastnik
5954dafdbc
Indent array and tuple lists too.
2021-05-09 19:02:35 +09:00
Blaž Hrastnik
6c705f09e8
Lint
2021-05-09 17:13:59 +09:00
Blaž Hrastnik
7c915dc065
Add the :new command, don't crash if saving without filename.
2021-05-07 14:19:58 +09:00
Blaž Hrastnik
f8844c6811
Implement pair expansion when pressing new line between bracket pairs.
...
From:
{|}
To:
{
|
}
2021-05-06 23:02:32 +09:00
Blaž Hrastnik
fd4fd12fa3
clippy lint
2021-05-06 17:20:00 +09:00
Blaž Hrastnik
28c167d71d
doc: Be smarter about calculating modified status.
...
This way edit -> undo will properly show up as unmodified.
2021-05-03 17:23:11 +09:00
Blaž Hrastnik
7e9ea30a0b
auto_pairs: move if cursor, extend if selection.
2021-04-22 23:26:57 +09:00
Blaž Hrastnik
5edb374237
And some more indent patterns.
2021-04-14 17:14:13 +09:00
Blaž Hrastnik
9e6c8c2a5a
Rust: add a few more scopes to indent.
2021-04-14 15:39:31 +09:00
Blaž Hrastnik
9445b24b88
Simplify calculate_indentation.
2021-04-14 14:28:31 +09:00
Blaž Hrastnik
95dd55ba94
Fix overlap calculation.
2021-04-10 12:02:23 +09:00
Blaž Hrastnik
73f4abbb37
N as extend with search (for now, N should be search_prev).
2021-04-10 00:21:13 +09:00
Blaž Hrastnik
35b4fe4cd0
Fix range.overlap()
2021-04-10 00:20:12 +09:00
Blaž Hrastnik
c1e5733b02
Remove the path specifier.
2021-04-09 18:57:46 +09:00
Blaž Hrastnik
71c06c11cb
Import tree sitter queries.
2021-04-08 23:25:35 +09:00
Blaž Hrastnik
bc4e54c0c4
Load config files from ~/.config/helix, fallback to defaults.
2021-04-07 23:56:20 +09:00
Blaž Hrastnik
f0d49d3ca4
hack: make queries load relative to source dir for now.
...
We want to provide a runtime dir later on.
2021-04-07 18:05:59 +09:00
Blaž Hrastnik
e8298a398c
Fix selection rendering, it would be off by 1 if reverse.
2021-04-07 16:57:58 +09:00
Blaž Hrastnik
63e602bda6
Fix issues with "enum A {|}" <Enter> indent calculation.
2021-04-07 16:39:13 +09:00
Blaž Hrastnik
9dfd6f6bbc
clippy lint
2021-04-06 20:00:35 +09:00
Blaž Hrastnik
f00cb15137
core: Improve changeset composition behavior.
...
It would fail to combine with an empty set.
2021-04-06 19:01:48 +09:00
Blaž Hrastnik
015fd2ffa2
pairs: Use token utf8 lengths instead of 1.
2021-04-06 17:28:56 +09:00
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).
2021-04-05 16:35:04 +09:00
Blaž Hrastnik
cc058ad78f
Simplify some code.
2021-04-01 11:04:25 +09:00
Blaž Hrastnik
9eaef6e333
Fully drop State references.
2021-03-31 15:45:18 +09:00
Blaž Hrastnik
742b3a709f
Store intra-files jumps (goto) on the jumplist.
2021-03-29 16:32:42 +09:00
Blaž Hrastnik
1d96cbfbd2
Transaction: Add a changes_iter() that can convert back to a list of Changes
2021-03-29 14:56:00 +09:00
Blaž Hrastnik
a74ff6bc03
Transaction: need to consume insert | delete properly.
2021-03-29 14:55:35 +09:00
Blaž Hrastnik
b52474cf66
clippy lint
2021-03-27 12:14:58 +09:00
Blaž Hrastnik
ad3325db8e
minor: Remove a few unwraps.
2021-03-26 11:03:14 +09:00
Blaž Hrastnik
8b28bf2533
Fix broken test.
2021-03-25 16:53:32 +09:00
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.
2021-03-25 15:26:25 +09:00
Blaž Hrastnik
9a36d2c2a8
wip: Hooks & trigger characters for completion/signature_help.
2021-03-24 18:17:00 +09:00
Blaž Hrastnik
06aca7691c
clippy lint
2021-03-24 14:58:01 +09:00
Blaž Hrastnik
d0530fb839
Fix a scrolling crash where it would jump past the end of the buffer.
2021-03-22 18:06:52 +09:00
Blaž Hrastnik
73c92a0bc1
Implement m / match_brackets (using tree sitter).
2021-03-22 17:58:49 +09:00
Blaž Hrastnik
bd607b4cbd
Provide a capacity on Selection::new's normalize.
2021-03-22 14:50:08 +09:00
Blaž Hrastnik
5e6716c89c
Add tab_width and indent_unit config.
2021-03-22 13:53:36 +09:00
Blaž Hrastnik
cbcacb1063
Merge some imports.
2021-03-22 12:40:07 +09:00
Blaž Hrastnik
c4792efead
clippy lints
2021-03-22 12:29:55 +09:00
Blaž Hrastnik
798dbd27c5
Selection: fail early if new() is called with no ranges.
2021-03-22 12:22:33 +09:00
Blaž Hrastnik
71999cce43
Implement auto-pairs behavior for open and close.
2021-03-22 12:22:33 +09:00
Blaž Hrastnik
f29f01858d
Implement iter() and len() directly on Selection.
2021-03-19 11:14:13 +09:00
Blaž Hrastnik
c331721565
Finish hiding doc.state / State as an implementation detail.
2021-03-18 15:07:02 +09:00
Blaž Hrastnik
59e6024186
Remove State from a few more signatures.
2021-03-18 14:17:32 +09:00
Blaž Hrastnik
dbcc099f48
Move things out of state.rs.
2021-03-18 14:07:53 +09:00
Blaž Hrastnik
8eaf9a432d
Make Transaction::change only rely on the rope.
2021-03-18 13:39:56 +09:00
Blaž Hrastnik
4f77d80e74
Clippy lint
2021-03-16 13:51:35 +09:00
Blaž Hrastnik
081e0ae8ae
syntax: highlight_iter always returns Ok()
2021-03-16 13:51:35 +09:00
Blaž Hrastnik
71f899cb5b
syntax: Highlight using ropes, avoiding dumping whole doc to string.
2021-03-16 13:47:06 +09:00
Blaž Hrastnik
dd91090a1a
Implement keep_selections (filter selections on regex).
2021-03-15 17:09:18 +09:00
Blaž Hrastnik
87e3cd3df2
ui: Render diagnostic errors in sideline.
2021-03-15 16:19:31 +09:00
Blaž Hrastnik
9c55b3e306
state.rs cleanup
2021-03-15 14:45:09 +09:00
Blaž Hrastnik
bb87b08fc9
Configure language servers via LanguageConfiguration.
2021-03-14 17:14:34 +09:00
Blaž Hrastnik
1cf887dea9
Cleanup: use doc.selection() instead of doc.state.selection().
2021-03-14 17:14:34 +09:00
Blaž Hrastnik
3445abf88e
syntax: Hide the TSParser internally, borrowing when needed.
2021-03-13 11:06:02 +09:00
Blaž Hrastnik
b7dd7310c4
syntax: Reuse parser instances. highlight_iter() no longer needs &mut.
2021-03-12 14:46:23 +09:00
Blaž Hrastnik
9dcfe25e4a
Use diagnostic.severity to distinguish between error colors.
2021-03-11 16:31:49 +09:00
Blaž Hrastnik
4acf301022
Implement the f/t/F/T find/till family of commands.
2021-03-11 16:15:27 +09:00
Blaž Hrastnik
62c991230f
find-till (f) prototype, on_next_key mode implementation.
2021-03-11 10:44:38 +09:00
Blaž Hrastnik
90f9cd6d62
search: draft f/t
2021-03-10 17:50:46 +09:00
Blaž Hrastnik
a16c6e2585
clippy lints
2021-03-01 17:37:31 +09:00
Blaž Hrastnik
2c9b02039b
commands: Implement join_selections.
2021-02-26 17:21:59 +09:00
Blaž Hrastnik
ad58286dc7
graphemes: fix nth_prev_grapheme_boundary calculation.
2021-02-26 15:53:01 +09:00
Blaž Hrastnik
01907b3497
commands: Implement count for a few more commands.
2021-02-25 16:49:30 +09:00
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.
2021-02-24 17:12:44 +09:00
Blaž Hrastnik
f118e7580f
Improve coords_at_pos & pos_at_coords, test with graphemes.
2021-02-24 16:08:17 +09:00
Blaž Hrastnik
87a6d4e736
minor: Simplify some code.
2021-02-24 16:07:39 +09:00
Blaž Hrastnik
6cfb1acb9d
commands: Implement expand_selection.
2021-02-22 17:02:32 +09:00
Blaž Hrastnik
33c67f1388
commands: add * as selection search.
2021-02-22 15:14:02 +09:00
Blaž Hrastnik
9132c6a591
Make some Document fields read-only.
2021-02-21 19:47:21 +09:00
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
}
2021-02-19 14:55:53 +09:00
Blaž Hrastnik
7a1ff5e45f
commands: Wire up toggle comments as ctrl-c
2021-02-19 13:59:24 +09:00
Blaž Hrastnik
4ab5631d65
more lints
2021-02-18 18:45:41 +09:00
Blaž Hrastnik
d0791e0f98
core: Implement comment toggling module.
2021-02-18 18:35:39 +09:00
Blaž Hrastnik
c9dd1c930e
treewide: &RopeSlice -> RopeSlice. It's Copy so no reason to pass by ref
2021-02-18 18:34:22 +09:00
Blaž Hrastnik
af55ebd002
transaction: Also modify map_pos to work with insert|delete order.
2021-02-18 12:17:33 +09:00
Blaž Hrastnik
9cac44c7c0
minor changes
2021-02-17 17:26:27 +09:00
Blaž Hrastnik
d8bc19f715
Update deps, switch tendril over to crates.io
2021-02-16 18:11:17 +09:00
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
}
}
}
2021-02-16 13:39:04 +09:00
Blaž Hrastnik
b0b5451c38
Since insert preceedes deletes, follow that ordering in Transaction::changes.
...
Produces the same output but will take the happy path.
2021-02-16 11:09:05 +09:00
Blaž Hrastnik
b4312c9492
transaction: Use builder methods to generate compact changesets.
2021-02-16 11:03:36 +09:00
Blaž Hrastnik
19fb4ed835
transaction: Merge consecutive inserts on compose.
2021-02-16 00:15:49 +09:00
Blaž Hrastnik
65893a2cbc
fix test
2021-02-16 00:15:38 +09:00
Blaž Hrastnik
239db79834
Finally: Retain horizontal position when moving vertically.
2021-02-12 16:49:24 +09:00
Blaž Hrastnik
a924ad2885
simplify.
2021-02-05 16:06:48 +09:00
Blaž Hrastnik
2bea5db7bd
commands: Implement select_on_matches.
2021-01-22 17:13:14 +09:00
Blaž Hrastnik
7c99ff58fd
nix: include rust-src so rust-analyzer works correctly.
2021-01-19 16:16:15 +09:00
Blaž Hrastnik
22e1692adc
indent: Fix edge cases, refactor test.
2021-01-10 23:46:18 +09:00
Blaž Hrastnik
777a80917d
Address clippy lints.
2021-01-08 16:37:36 +09:00