Skip to content

Commit

Permalink
fixup! add anchored movement commands
Browse files Browse the repository at this point in the history
  • Loading branch information
pantos9000 committed May 1, 2024
1 parent 37e9e5d commit 5b70c2b
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions helix-core/src/movement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,10 +269,6 @@ fn move_anchored(
}

/// Move to the next newline character, in direction of movement.
///
/// Note: We can't use the given `move_fn` here. If we move visually backwards and soft-wrap is
/// enabled, we would end up in the same line, and get the same newline character that we are
/// actually coming from.
fn move_to_next_newline(
slice: RopeSlice,
range: Range,
Expand All @@ -282,7 +278,10 @@ fn move_anchored(
text_fmt: &TextFormat,
annotations: &mut TextAnnotations,
) -> Range {
// move to new position
// Move to new position.
// Note: We can't use the given `move_fn` here. If we move visually backwards and soft-wrap
// is enabled, we would end up in the same line, and get the same newline character that we
// are actually coming from.
let new_range = move_vertically(slice, range, dir, count, behaviour, text_fmt, annotations);
let new_pos = new_range.cursor(slice);
let new_line = slice.char_to_line(new_pos);
Expand Down Expand Up @@ -336,8 +335,6 @@ fn move_anchored(
pos_is_at_end_of_line && (stayed_on_newline_before || !pos_is_in_empty_line);

if stay_on_newline {
// we are currently on a newline character, so we want to navigate to the
// newline character on the new line that we move to
move_to_next_newline(
slice,
new_range,
Expand Down

0 comments on commit 5b70c2b

Please sign in to comment.