🎨 Rename and simplify some autoindent stuff

This commit is contained in:
Max Brunsfeld 2022-07-28 22:34:56 -07:00
parent 7a26fa18c7
commit 868c460620
10 changed files with 112 additions and 94 deletions

View file

@ -278,7 +278,7 @@ fn paste(_: &mut Workspace, _: &Paste, cx: &mut ViewContext<Workspace>) {
}
}
drop(snapshot);
buffer.edit(edits, Some(AutoindentMode::Independent), cx);
buffer.edit(edits, Some(AutoindentMode::EachLine), cx);
});
editor.change_selections(Some(Autoscroll::Fit), cx, |s| {

View file

@ -1,6 +1,5 @@
use editor::{ClipboardSelection, Editor};
use gpui::{ClipboardItem, MutableAppContext};
use std::cmp;
pub fn copy_selections_content(editor: &mut Editor, linewise: bool, cx: &mut MutableAppContext) {
let selections = editor.selections.all_adjusted(cx);
@ -18,10 +17,7 @@ pub fn copy_selections_content(editor: &mut Editor, linewise: bool, cx: &mut Mut
clipboard_selections.push(ClipboardSelection {
len: text.len() - initial_len,
is_entire_line: linewise,
first_line_indent: cmp::min(
start.column,
buffer.indent_size_for_line(start.row).len,
),
first_line_indent: buffer.indent_size_for_line(start.row).len,
});
}
}

View file

@ -254,7 +254,7 @@ pub fn paste(_: &mut Workspace, _: &VisualPaste, cx: &mut ViewContext<Workspace>
}
}
drop(snapshot);
buffer.edit(edits, Some(AutoindentMode::Independent), cx);
buffer.edit(edits, Some(AutoindentMode::EachLine), cx);
});
editor.change_selections(Some(Autoscroll::Fit), cx, |s| {