From 4ccbcabfeef28f812d58441840962ec46fc679a3 Mon Sep 17 00:00:00 2001 From: HuaGu-Dragon <1801943622@qq.com> Date: Wed, 26 Aug 2026 14:28:43 +0000 Subject: [PATCH] movement: Remove unused `stop_at_soft_boundaries` parameter from `line_beginning` (#63245) # Objective remove the entire `stop_at_soft_boundaries` parameter from `line_beginning`, since it was never used --- Release Notes: - N/A --- crates/editor/src/movement.rs | 26 ++++++++------------------ crates/vim/src/helix/paste.rs | 2 +- crates/vim/src/normal/paste.rs | 2 +- 3 files changed, 10 insertions(+), 20 deletions(-) diff --git a/crates/editor/src/movement.rs b/crates/editor/src/movement.rs index 5384c9c405..4b6a3f12b5 100644 --- a/crates/editor/src/movement.rs +++ b/crates/editor/src/movement.rs @@ -190,26 +190,16 @@ pub(crate) fn down_by_rows( } /// Returns a position of the start of line. -/// If `stop_at_soft_boundaries` is true, the returned position is that of the -/// displayed line (e.g. it could actually be in the middle of a text line if that line is soft-wrapped). -/// Otherwise it's always going to be the start of a logical line. -pub fn line_beginning( - map: &DisplaySnapshot, - display_point: DisplayPoint, - stop_at_soft_boundaries: bool, -) -> DisplayPoint { - let point = display_point.to_point(map); - let soft_line_start = map.clip_point(DisplayPoint::new(display_point.row(), 0), Bias::Right); - let line_start = map.prev_line_boundary(point).1; - - if stop_at_soft_boundaries && display_point != soft_line_start { - soft_line_start - } else { - line_start - } +/// +/// It's always going to be the start of a logical line. +/// If you want to stop at last indented position or soft boundaries, +/// use [`indented_line_beginning`] instead. +pub fn line_beginning(map: &DisplaySnapshot, display_point: DisplayPoint) -> DisplayPoint { + map.prev_line_boundary(display_point.to_point(map)).1 } -/// Returns the last indented position on a given line. +/// Returns the last indented position or the start of a given line. +/// /// If `stop_at_soft_boundaries` is true, the returned [`DisplayPoint`] is that of a /// displayed line (e.g. if there's soft wrap it's gonna be returned), /// otherwise it's always going to be a start of a logical line. diff --git a/crates/vim/src/helix/paste.rs b/crates/vim/src/helix/paste.rs index e388aa7a11..b67c6243d3 100644 --- a/crates/vim/src/helix/paste.rs +++ b/crates/vim/src/helix/paste.rs @@ -93,7 +93,7 @@ impl Vim { // Pasting before means pasting before the whole selection. let display_point = if line_mode { if action.before { - movement::line_beginning(&display_map, sel.start, false) + movement::line_beginning(&display_map, sel.start) } else { if sel.start == sel.end { movement::right( diff --git a/crates/vim/src/normal/paste.rs b/crates/vim/src/normal/paste.rs index 610c5eb358..b9b6801838 100644 --- a/crates/vim/src/normal/paste.rs +++ b/crates/vim/src/normal/paste.rs @@ -166,7 +166,7 @@ impl Vim { selection.start..end_point } else if line_mode { let point = if before { - movement::line_beginning(&display_map, selection.start, false) + movement::line_beginning(&display_map, selection.start) } else { movement::line_end(&display_map, selection.start, false) };