| Commit message (Collapse) | Author | Age |
|
|
|
|
|
|
|
|
|
|
| |
* correctly map unsorted positions
* Fix typo
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
---------
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently, when forward deleting (`delete_char_forward` bound to `del`,
`delete_word_forward`, `kill_to_line_end`) the cursor is moved to the
left in append mode (or generally when the cursor is at the end of the
selection). For example in a document `|abc|def` (|indicates selection)
if enter append mode the cursor is moved to `c` and the selection
becomes: `|abcd|ef`. When deleting forward (`del`) `d` is deleted. The
expectation would be that the selection doesn't shrink so that `del`
again deletes `e` and then `f`. This would look as follows:
`|abcd|ef`
`|abce|f`
`|abcf|`
`|abc |`
This is inline with how other editors like kakoune work.
However, helix currently moves the selection backwards leading to the
following behavior:
`|abcd|ef`
`|abc|ef`
`|ab|ef`
`ef`
This means that `delete_char_forward` essentially acts like
`delete_char_backward` after deleting the first character in append
mode.
To fix the problem the cursor must be moved to the right while deleting
forward (first fix in this commit). Furthermore, when the EOF char is
reached a newline char must be inserted (just like when entering
appendmode) to prevent the cursor from moving to the right
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Some deletion operations (especially those that use indentation)
can generate overlapping deletion ranges when using multiple cursors.
To fix that problem a new `Transaction::delete` and
`Transaction:delete_by_selection` function were added. These functions
merge overlapping deletion ranges instead of generating an invalid
transaction. This merging of changes is only possible for deletions
and not for other changes and therefore require its own function.
The function has been used in all commands that currently delete
text by using `Transaction::change_by_selection`.
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit adds new functions to `Transaction` that allow creating
edits that might potentially overlap. Any change that overlaps
previous changes is ignored. Furthermore, a utility method is added
that also drops selections associated with dropped changes (for
transactions that are created from a selection).
This is needed to avoid crashes when applying multicursor
autocompletions, as the edit from a previous cursor may overlap
with the next cursor/edit.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* properly handle LSP position encoding
* add debug assertion to Transaction::change
* Apply suggestions from code review
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
---------
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
|
|
|
|
|
| |
* bump ropey to 1.5.1-alpha
* significantly improve performance of :reload
|
| |
|
| |
|
| |
|
|
|
|
| |
Slightly smaller API surface, less dependencies.
|
|
|
| |
Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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
|
| |
|
|
|
|
| |
Fixes #1221
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
This is a legacy type that should be fully removed.
|
|
|
|
| |
Size hint is enough.
|
|
|
|
|
| |
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.
|
|
|
|
| |
Still a bunch more warnings to fix in core, but it's a start.
|
| |
|
|
|
|
| |
Refs #386
|
|
|
|
| |
Note that this also removed those `finish_non_exhaustive()`.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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>
|
|
|
|
|
|
|
| |
* init
* wip
* wip
|
|
|
|
|
| |
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.
|
|
|
|
| |
It would fail to combine with an empty set.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
}
}
}
|
|
|
|
| |
Produces the same output but will take the happy path.
|
| |
|
| |
|
| |
|
| |
|
| |
|