Remove actions UnfoldAt
and FoldAt
(#28442)
`UnfoldAt` and `FoldAt` are used internally, and don't really work when users try to trigger them, they do however appear in the command palette and keybindings, misleading users to try using them. Release Notes: - Remove unused actions `UnfoldAt` and `FoldAt` (prefer `Fold` and `Unfold`).
This commit is contained in:
parent
9f6c5e2877
commit
b47aa33459
4 changed files with 22 additions and 46 deletions
|
@ -110,20 +110,6 @@ pub struct ToggleComments {
|
|||
pub ignore_indent: bool,
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct FoldAt {
|
||||
#[serde(skip)]
|
||||
pub buffer_row: MultiBufferRow,
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct UnfoldAt {
|
||||
#[serde(skip)]
|
||||
pub buffer_row: MultiBufferRow,
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct MoveUpByLines {
|
||||
|
@ -226,7 +212,6 @@ impl_actions!(
|
|||
ExpandExcerpts,
|
||||
ExpandExcerptsDown,
|
||||
ExpandExcerptsUp,
|
||||
FoldAt,
|
||||
HandleInput,
|
||||
MoveDownByLines,
|
||||
MovePageDown,
|
||||
|
@ -244,7 +229,6 @@ impl_actions!(
|
|||
ShowCompletions,
|
||||
ToggleCodeActions,
|
||||
ToggleComments,
|
||||
UnfoldAt,
|
||||
FoldAtLevel,
|
||||
]
|
||||
);
|
||||
|
|
|
@ -14915,8 +14915,12 @@ impl Editor {
|
|||
self.fold_creases(to_fold, true, window, cx);
|
||||
}
|
||||
|
||||
pub fn fold_at(&mut self, fold_at: &FoldAt, window: &mut Window, cx: &mut Context<Self>) {
|
||||
let buffer_row = fold_at.buffer_row;
|
||||
pub fn fold_at(
|
||||
&mut self,
|
||||
buffer_row: MultiBufferRow,
|
||||
window: &mut Window,
|
||||
cx: &mut Context<Self>,
|
||||
) {
|
||||
let display_map = self.display_map.update(cx, |map, cx| map.snapshot(cx));
|
||||
|
||||
if let Some(crease) = display_map.crease_for_buffer_row(buffer_row) {
|
||||
|
@ -14986,16 +14990,16 @@ impl Editor {
|
|||
|
||||
pub fn unfold_at(
|
||||
&mut self,
|
||||
unfold_at: &UnfoldAt,
|
||||
buffer_row: MultiBufferRow,
|
||||
_window: &mut Window,
|
||||
cx: &mut Context<Self>,
|
||||
) {
|
||||
let display_map = self.display_map.update(cx, |map, cx| map.snapshot(cx));
|
||||
|
||||
let intersection_range = Point::new(unfold_at.buffer_row.0, 0)
|
||||
let intersection_range = Point::new(buffer_row.0, 0)
|
||||
..Point::new(
|
||||
unfold_at.buffer_row.0,
|
||||
display_map.buffer_snapshot.line_len(unfold_at.buffer_row),
|
||||
buffer_row.0,
|
||||
display_map.buffer_snapshot.line_len(buffer_row),
|
||||
);
|
||||
|
||||
let autoscroll = self
|
||||
|
@ -19364,15 +19368,11 @@ impl EditorSnapshot {
|
|||
Arc::new(move |folded, window: &mut Window, cx: &mut App| {
|
||||
if folded {
|
||||
editor.update(cx, |editor, cx| {
|
||||
editor.fold_at(&crate::FoldAt { buffer_row }, window, cx)
|
||||
editor.fold_at(buffer_row, window, cx)
|
||||
});
|
||||
} else {
|
||||
editor.update(cx, |editor, cx| {
|
||||
editor.unfold_at(
|
||||
&crate::UnfoldAt { buffer_row },
|
||||
window,
|
||||
cx,
|
||||
)
|
||||
editor.unfold_at(buffer_row, window, cx)
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -19396,9 +19396,9 @@ impl EditorSnapshot {
|
|||
.toggle_state(folded)
|
||||
.on_click(window.listener_for(&editor, move |this, _e, window, cx| {
|
||||
if folded {
|
||||
this.unfold_at(&UnfoldAt { buffer_row }, window, cx);
|
||||
this.unfold_at(buffer_row, window, cx);
|
||||
} else {
|
||||
this.fold_at(&FoldAt { buffer_row }, window, cx);
|
||||
this.fold_at(buffer_row, window, cx);
|
||||
}
|
||||
}))
|
||||
.into_any_element(),
|
||||
|
|
|
@ -387,14 +387,12 @@ impl EditorElement {
|
|||
register_action(editor, window, Editor::fold_at_level);
|
||||
register_action(editor, window, Editor::fold_all);
|
||||
register_action(editor, window, Editor::fold_function_bodies);
|
||||
register_action(editor, window, Editor::fold_at);
|
||||
register_action(editor, window, Editor::fold_recursive);
|
||||
register_action(editor, window, Editor::toggle_fold);
|
||||
register_action(editor, window, Editor::toggle_fold_recursive);
|
||||
register_action(editor, window, Editor::unfold_lines);
|
||||
register_action(editor, window, Editor::unfold_recursive);
|
||||
register_action(editor, window, Editor::unfold_all);
|
||||
register_action(editor, window, Editor::unfold_at);
|
||||
register_action(editor, window, Editor::fold_selected_ranges);
|
||||
register_action(editor, window, Editor::set_mark);
|
||||
register_action(editor, window, Editor::swap_selection_ends);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue