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

@ -9371,7 +9371,12 @@ impl Editor {
self.change_selections(Some(Autoscroll::fit()), window, cx, |s| {
s.move_cursors_with(|map, head, _| {
(
movement::indented_line_beginning(map, head, action.stop_at_soft_wraps),
movement::indented_line_beginning(
map,
head,
action.stop_at_soft_wraps,
action.stop_at_indent,
),
SelectionGoal::None,
)
});
@ -9387,7 +9392,12 @@ impl Editor {
self.change_selections(Some(Autoscroll::fit()), window, cx, |s| {
s.move_heads_with(|map, head, _| {
(
movement::indented_line_beginning(map, head, action.stop_at_soft_wraps),
movement::indented_line_beginning(
map,
head,
action.stop_at_soft_wraps,
action.stop_at_indent,
),
SelectionGoal::None,
)
});
@ -9410,6 +9420,7 @@ impl Editor {
this.select_to_beginning_of_line(
&SelectToBeginningOfLine {
stop_at_soft_wraps: false,
stop_at_indent: false,
},
window,
cx,