Rename Editor::unfold to Editor::unfold_lines

This commit is contained in:
Antonio Scandurra 2022-03-24 17:15:40 +01:00
parent 4f50da759a
commit 78b52168fa

View file

@ -122,7 +122,7 @@ action!(ConfirmRename);
action!(PageUp); action!(PageUp);
action!(PageDown); action!(PageDown);
action!(Fold); action!(Fold);
action!(Unfold); action!(UnfoldLines);
action!(FoldSelectedRanges); action!(FoldSelectedRanges);
action!(Scroll, Vector2F); action!(Scroll, Vector2F);
action!(Select, SelectPhase); action!(Select, SelectPhase);
@ -263,7 +263,7 @@ pub fn init(cx: &mut MutableAppContext) {
Binding::new("pageup", PageUp, Some("Editor")), Binding::new("pageup", PageUp, Some("Editor")),
Binding::new("pagedown", PageDown, Some("Editor")), Binding::new("pagedown", PageDown, Some("Editor")),
Binding::new("alt-cmd-[", Fold, Some("Editor")), Binding::new("alt-cmd-[", Fold, Some("Editor")),
Binding::new("alt-cmd-]", Unfold, Some("Editor")), Binding::new("alt-cmd-]", UnfoldLines, Some("Editor")),
Binding::new("alt-cmd-f", FoldSelectedRanges, Some("Editor")), Binding::new("alt-cmd-f", FoldSelectedRanges, Some("Editor")),
Binding::new("ctrl-space", ShowCompletions, Some("Editor")), Binding::new("ctrl-space", ShowCompletions, Some("Editor")),
Binding::new("cmd-.", ToggleCodeActions(false), Some("Editor")), Binding::new("cmd-.", ToggleCodeActions(false), Some("Editor")),
@ -329,7 +329,7 @@ pub fn init(cx: &mut MutableAppContext) {
cx.add_action(Editor::page_up); cx.add_action(Editor::page_up);
cx.add_action(Editor::page_down); cx.add_action(Editor::page_down);
cx.add_action(Editor::fold); cx.add_action(Editor::fold);
cx.add_action(Editor::unfold); cx.add_action(Editor::unfold_lines);
cx.add_action(Editor::fold_selected_ranges); cx.add_action(Editor::fold_selected_ranges);
cx.add_action(Editor::show_completions); cx.add_action(Editor::show_completions);
cx.add_action(Editor::toggle_code_actions); cx.add_action(Editor::toggle_code_actions);
@ -5187,7 +5187,7 @@ impl Editor {
self.fold_ranges(fold_ranges, cx); self.fold_ranges(fold_ranges, cx);
} }
pub fn unfold(&mut self, _: &Unfold, cx: &mut ViewContext<Self>) { pub fn unfold_lines(&mut self, _: &UnfoldLines, cx: &mut ViewContext<Self>) {
let selections = self.local_selections::<Point>(cx); let selections = self.local_selections::<Point>(cx);
let display_map = self.display_map.update(cx, |map, cx| map.snapshot(cx)); let display_map = self.display_map.update(cx, |map, cx| map.snapshot(cx));
let buffer = &display_map.buffer_snapshot; let buffer = &display_map.buffer_snapshot;
@ -6467,7 +6467,7 @@ mod tests {
.unindent(), .unindent(),
); );
view.unfold(&Unfold, cx); view.unfold_lines(&UnfoldLines, cx);
assert_eq!( assert_eq!(
view.display_text(cx), view.display_text(cx),
" "
@ -6488,7 +6488,7 @@ mod tests {
.unindent(), .unindent(),
); );
view.unfold(&Unfold, cx); view.unfold_lines(&UnfoldLines, cx);
assert_eq!(view.display_text(cx), buffer.read(cx).read(cx).text()); assert_eq!(view.display_text(cx), buffer.read(cx).read(cx).text());
}); });
} }