Add stop_at_indent for MoveToBeginningOfLine (#25428)

Add support for `stop_at_indent` option for MoveToBeginningOfLine and SelectToBeginningOfLine instead of mixing that with `stop_at_soft_wraps`.
Add emacs mapping for `alt-m` (`back-to-indentation`)
This commit is contained in:
Peter Tripp 2025-02-25 12:03:14 -05:00 committed by GitHub
parent 3a3621f2d8
commit eebee4ab18
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 40 additions and 16 deletions

View file

@ -214,6 +214,7 @@ pub fn indented_line_beginning(
map: &DisplaySnapshot,
display_point: DisplayPoint,
stop_at_soft_boundaries: bool,
stop_at_indent: bool,
) -> DisplayPoint {
let point = display_point.to_point(map);
let soft_line_start = map.clip_point(DisplayPoint::new(display_point.row(), 0), Bias::Right);
@ -229,7 +230,7 @@ pub fn indented_line_beginning(
if stop_at_soft_boundaries && soft_line_start > indent_start && display_point != soft_line_start
{
soft_line_start
} else if stop_at_soft_boundaries && display_point != indent_start {
} else if stop_at_indent && display_point != indent_start {
indent_start
} else {
line_start