Skip to content

Commit

Permalink
add condition to cursor moving back on normal
Browse files Browse the repository at this point in the history
  • Loading branch information
wmstack committed Jan 29, 2024
1 parent 8703ad4 commit 19d2e74
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion helix-view/src/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1904,9 +1904,14 @@ impl Editor {
if doc.restore_cursor {
let text = doc.text().slice(..);
let selection = doc.selection(view.id).clone().transform(|range| {
let mut head = range.to();
if range.head > range.anchor {
head = graphemes::prev_grapheme_boundary(text, head);
}

Range::new(
range.from(),
graphemes::prev_grapheme_boundary(text, range.to()),
head
)
});

Expand Down

0 comments on commit 19d2e74

Please sign in to comment.