Blaž Hrastnik
376d99a51d
core: transaction: Resolve some TODOs
3 years ago
Blaž Hrastnik
f88c077f99
Replace tendril with smartstring
...
Slightly smaller API surface, less dependencies.
3 years ago
Omnikar
f064894e57
Fix Clippy lints in tests ( #1563 )
...
Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
3 years ago
Skyler Hawthorne
94535fa013
Add auto pairs for same-char pairs ( #1219 )
...
* Add auto pairs for same-char pairs
* Add unit tests for all existing functionality
* Add auto pairs for same-char pairs (quotes, etc). Account for
apostrophe in prose by requiring both sides of the cursor to be
non-pair chars or whitespace. This also incidentally will work for
avoiding a double single quote in lifetime annotations, at least until
<> is added
* Slight factor of moving the cursor transform of the selection to
inside the hooks. This will enable doing auto pairing with selections,
and fixing the bug where auto pairs destroy the selection.
Fixes #1014
3 years ago
Blaž Hrastnik
01f7a312d0
Address new lint on 1.57
3 years ago
Blaž Hrastnik
119dee2980
fix: Correctly detect empty transactions
...
Fixes #1221
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
Brian Shu
fa4caf7e3d
remove unsafe
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
Blaž Hrastnik
bf43fabf65
Remove ExactSizeIterator requirement on Transaction::change
...
Size hint is enough.
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
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
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
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
Kirawi
c17dcb8633
Fixing Multiple Panics ( #121 )
...
* init
* wip
* wip
3 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.
3 years ago
Blaž Hrastnik
f00cb15137
core: Improve changeset composition behavior.
...
It would fail to combine with an empty set.
3 years ago
Blaž Hrastnik
9eaef6e333
Fully drop State references.
3 years ago
Blaž Hrastnik
1d96cbfbd2
Transaction: Add a changes_iter() that can convert back to a list of Changes
3 years ago
Blaž Hrastnik
a74ff6bc03
Transaction: need to consume insert | delete properly.
3 years ago
Blaž Hrastnik
06aca7691c
clippy lint
3 years ago
Blaž Hrastnik
cbcacb1063
Merge some imports.
4 years ago
Blaž Hrastnik
798dbd27c5
Selection: fail early if new() is called with no ranges.
4 years ago
Blaž Hrastnik
f29f01858d
Implement iter() and len() directly on Selection.
4 years ago
Blaž Hrastnik
59e6024186
Remove State from a few more signatures.
4 years ago
Blaž Hrastnik
8eaf9a432d
Make Transaction::change only rely on the rope.
4 years ago
Blaž Hrastnik
1cf887dea9
Cleanup: use doc.selection() instead of doc.state.selection().
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
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
777a80917d
Address clippy lints.
4 years ago
Blaž Hrastnik
cc6bdf8f66
Text change generation, RPC call handling.
4 years ago
Blaž Hrastnik
b39849dde1
Refactor: Document type as a wrapper around barebones State.
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
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