fix final failing tests
This commit is contained in:
parent
f6f41510d2
commit
2cf48c03f9
6 changed files with 55 additions and 48 deletions
|
@ -3709,18 +3709,30 @@ impl Editor {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn move_page_up(&mut self, action: &MovePageUp, cx: &mut ViewContext<Self>) -> Option<()> {
|
||||
self.take_rename(true, cx)?;
|
||||
if self.context_menu.as_mut()?.select_first(cx) {
|
||||
return None;
|
||||
pub fn move_page_up(&mut self, action: &MovePageUp, cx: &mut ViewContext<Self>) {
|
||||
if self.take_rename(true, cx).is_some() {
|
||||
return;
|
||||
}
|
||||
|
||||
if self
|
||||
.context_menu
|
||||
.as_mut()
|
||||
.map(|menu| menu.select_first(cx))
|
||||
.unwrap_or(false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if matches!(self.mode, EditorMode::SingleLine) {
|
||||
cx.propagate_action();
|
||||
return None;
|
||||
return;
|
||||
}
|
||||
|
||||
let row_count = self.visible_line_count()? as u32 - 1;
|
||||
let row_count = if let Some(row_count) = self.visible_line_count() {
|
||||
row_count as u32 - 1
|
||||
} else {
|
||||
return;
|
||||
};
|
||||
|
||||
let autoscroll = if action.center_cursor {
|
||||
Autoscroll::center()
|
||||
|
@ -3739,8 +3751,6 @@ impl Editor {
|
|||
selection.collapse_to(cursor, goal);
|
||||
});
|
||||
});
|
||||
|
||||
Some(())
|
||||
}
|
||||
|
||||
pub fn select_up(&mut self, _: &SelectUp, cx: &mut ViewContext<Self>) {
|
||||
|
@ -3775,25 +3785,30 @@ impl Editor {
|
|||
});
|
||||
}
|
||||
|
||||
pub fn move_page_down(
|
||||
&mut self,
|
||||
action: &MovePageDown,
|
||||
cx: &mut ViewContext<Self>,
|
||||
) -> Option<()> {
|
||||
pub fn move_page_down(&mut self, action: &MovePageDown, cx: &mut ViewContext<Self>) {
|
||||
if self.take_rename(true, cx).is_some() {
|
||||
return None;
|
||||
return;
|
||||
}
|
||||
|
||||
if self.context_menu.as_mut()?.select_last(cx) {
|
||||
return None;
|
||||
if self
|
||||
.context_menu
|
||||
.as_mut()
|
||||
.map(|menu| menu.select_last(cx))
|
||||
.unwrap_or(false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if matches!(self.mode, EditorMode::SingleLine) {
|
||||
cx.propagate_action();
|
||||
return None;
|
||||
return;
|
||||
}
|
||||
|
||||
let row_count = self.visible_line_count()? as u32 - 1;
|
||||
let row_count = if let Some(row_count) = self.visible_line_count() {
|
||||
row_count as u32 - 1
|
||||
} else {
|
||||
return;
|
||||
};
|
||||
|
||||
let autoscroll = if action.center_cursor {
|
||||
Autoscroll::center()
|
||||
|
@ -3812,8 +3827,6 @@ impl Editor {
|
|||
selection.collapse_to(cursor, goal);
|
||||
});
|
||||
});
|
||||
|
||||
Some(())
|
||||
}
|
||||
|
||||
pub fn select_down(&mut self, _: &SelectDown, cx: &mut ViewContext<Self>) {
|
||||
|
|
|
@ -300,7 +300,7 @@ impl Item for Editor {
|
|||
false
|
||||
} else {
|
||||
let nav_history = self.nav_history.take();
|
||||
self.set_scroll_anchor(data.scroll_anchor, cx);
|
||||
self.set_scroll_anchor(scroll_anchor, cx);
|
||||
self.change_selections(Some(Autoscroll::fit()), cx, |s| {
|
||||
s.select_ranges([offset..offset])
|
||||
});
|
||||
|
|
|
@ -200,7 +200,6 @@ mod test {
|
|||
Test test
|
||||
ˇtest"})
|
||||
.await;
|
||||
println!("Marker");
|
||||
cx.assert(indoc! {"
|
||||
Test test
|
||||
ˇ
|
||||
|
|
|
@ -51,8 +51,9 @@ impl<'a> VimTestContext<'a> {
|
|||
)
|
||||
});
|
||||
|
||||
// Setup search toolbars
|
||||
// Setup search toolbars and keypress hook
|
||||
workspace.update(cx, |workspace, cx| {
|
||||
observe_keypresses(window_id, cx);
|
||||
workspace.active_pane().update(cx, |pane, cx| {
|
||||
pane.toolbar().update(cx, |toolbar, cx| {
|
||||
let buffer_search_bar = cx.add_view(BufferSearchBar::new);
|
||||
|
|
|
@ -81,20 +81,20 @@ pub fn init(cx: &mut MutableAppContext) {
|
|||
.detach();
|
||||
}
|
||||
|
||||
// Any keystrokes not mapped to vim should clar the active operator
|
||||
// Any keystrokes not mapped to vim should clear the active operator
|
||||
pub fn observe_keypresses(window_id: usize, cx: &mut MutableAppContext) {
|
||||
cx.observe_keystrokes(window_id, |_keystroke, _result, handled_by, cx| {
|
||||
dbg!(_keystroke);
|
||||
dbg!(_result);
|
||||
if let Some(handled_by) = handled_by {
|
||||
dbg!(handled_by.name());
|
||||
if handled_by.namespace() == "vim" {
|
||||
println!("Vim action. Don't clear");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Vim::update(cx, |vim, cx| {
|
||||
if vim.active_operator().is_some() {
|
||||
println!("Clearing operator");
|
||||
vim.clear_operator(cx);
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue