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
Blaž Hrastnik
f9bfba4d96
Reroute LSP notification events into the main app event loop.
4 years ago
Blaž Hrastnik
64b5b23315
Move theme from view to editor, support multiple views in editor.
4 years ago
Blaž Hrastnik
bc2c652fe8
Bugfix
4 years ago
Jan Hrastnik
7d58378374
added move left&right, delete char
4 years ago
Jan Hrastnik
ed03ec92a8
moved prompt command matching to prompt.rs
4 years ago
Jan Hrastnik
0c0c2c7103
modified editor.render() to prepare for command mode rendering
4 years ago
Blaž Hrastnik
16828d322a
wip
4 years ago
Blaž Hrastnik
6e658aae1c
Auto-indent on enter based on tree-sitter scopes.
4 years ago
Blaž Hrastnik
d64f4beede
Share tab width definitions.
4 years ago
Blaž Hrastnik
0b74d423d0
Validate compose len after applying a is same as before applying b.
4 years ago
Blaž Hrastnik
7fcc6f8f1b
Fix overlapping (insert | delete) compose
4 years ago
Blaž Hrastnik
94f9603c74
Fix compose not merging certain changesets correctly.
4 years ago
Blaž Hrastnik
00e661f600
Indent draft, linewise paste
4 years ago
Blaž Hrastnik
4a648555ed
Don't try to compose zero-width deletes.
4 years ago
Blaž Hrastnik
490e23b645
Simplify changeset tracking.
4 years ago
Blaž Hrastnik
8098279676
Cleanup
4 years ago
Blaž Hrastnik
1dba0f2b1c
Simple yank/paste registers.
4 years ago
Blaž Hrastnik
eba5b1ef33
Fix changeset composition, lengths don't have to match.
4 years ago
Blaž Hrastnik
b765c17896
Hacky undo/redo integration.
4 years ago
Blaž Hrastnik
04b1546634
history.redo()
4 years ago
Blaž Hrastnik
8c7bc71ede
Split on matches off by one, breaks tests again.
4 years ago
Blaž Hrastnik
fd311fb8ad
Undo tree draft.
...
We keep a tree of transactions. This allows for persistent undo by
simply serializing the changesets.
4 years ago
Blaž Hrastnik
5392b48268
Drop Coords.
4 years ago
Jan Hrastnik
038201647c
started work on goto mode
4 years ago
Blaž Hrastnik
883b77bd24
Fix transaction.invert()/.apply() using byte counts instead of char counts.
4 years ago
Blaž Hrastnik
aa077a07f3
Implement Transaction::invert.
4 years ago
Blaž Hrastnik
5945815d97
Fix cursor rendering & placement on append mode.
4 years ago
Blaž Hrastnik
e39bd211d1
argh -> clap to speed up compilation (no syn/proc_macro)
4 years ago
Blaž Hrastnik
592c5b0af2
Fix test, break split + append
4 years ago
Blaž Hrastnik
3feb00283d
clippy warnings
4 years ago
Blaž Hrastnik
1bb01d27ae
Simplify line ending calculation.
4 years ago
Blaž Hrastnik
13d1ea542e
Clamp character movement to line.
4 years ago
Blaž Hrastnik
36e7e2133f
Split selection on regex, fix InputEdit generation.
4 years ago
Blaž Hrastnik
3020077da8
Extend selection commands.
4 years ago
Blaž Hrastnik
e0785aabe7
Move-by-word commands: w, b, e.
4 years ago
Blaž Hrastnik
eb639eb2e4
More robust syntax detection/grammar loading.
4 years ago
Blaž Hrastnik
935cfeae57
Split parts of helix-term into helix-view.
...
It still largely depends on term for some types but I plan to change
that later.
4 years ago
Blaž Hrastnik
48330ddb5f
Command needs access to view information for certain changes.
4 years ago
Blaž Hrastnik
b120515613
Range based highlight_iter. Only works on limiting the start right now
4 years ago
Blaž Hrastnik
3859f6963d
More work on the UI.
4 years ago