Skip to content

Commit

Permalink
vim: Make jumping to marks scroll
Browse files Browse the repository at this point in the history
  • Loading branch information
Zachiah committed May 9, 2024
1 parent 0dba953 commit ecd328d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions crates/vim/src/normal/mark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ use std::{ops::Range, sync::Arc};
use collections::HashSet;
use editor::{
display_map::{DisplaySnapshot, ToDisplayPoint},
movement, Anchor, Bias, DisplayPoint,
movement,
scroll::Autoscroll,
Anchor, Bias, DisplayPoint,
};
use gpui::WindowContext;
use language::SelectionGoal;
Expand All @@ -24,7 +26,6 @@ pub fn create_mark(vim: &mut Vim, text: Arc<str>, tail: bool, cx: &mut WindowCon
}) else {
return;
};

vim.update_state(|state| state.marks.insert(text.to_string(), anchors));
vim.clear_operator(cx);
}
Expand Down Expand Up @@ -123,7 +124,9 @@ pub fn jump(text: Arc<str>, line: bool, cx: &mut WindowContext) {
}
ranges.insert(anchor..anchor);
}
editor.change_selections(None, cx, |s| s.select_anchor_ranges(ranges))
editor.change_selections(Some(Autoscroll::fit()), cx, |s| {
s.select_anchor_ranges(ranges)
})
});
})
}
Expand Down

0 comments on commit ecd328d

Please sign in to comment.