Links to channel notes (#7262)
Release Notes: - Added outline support for Markdown files - Added the ability to link to channel notes: https://zed.dev/channel/zed-283/notes#Roadmap
This commit is contained in:
parent
b35a7223b6
commit
69e0ea92e4
13 changed files with 260 additions and 65 deletions
|
@ -12,17 +12,26 @@ pub enum Autoscroll {
|
|||
}
|
||||
|
||||
impl Autoscroll {
|
||||
/// scrolls the minimal amount to (try) and fit all cursors onscreen
|
||||
pub fn fit() -> Self {
|
||||
Self::Strategy(AutoscrollStrategy::Fit)
|
||||
}
|
||||
|
||||
/// scrolls the minimal amount to fit the newest cursor
|
||||
pub fn newest() -> Self {
|
||||
Self::Strategy(AutoscrollStrategy::Newest)
|
||||
}
|
||||
|
||||
/// scrolls so the newest cursor is vertically centered
|
||||
pub fn center() -> Self {
|
||||
Self::Strategy(AutoscrollStrategy::Center)
|
||||
}
|
||||
|
||||
/// scrolls so the neweset cursor is near the top
|
||||
/// (offset by vertical_scroll_margin)
|
||||
pub fn focused() -> Self {
|
||||
Self::Strategy(AutoscrollStrategy::Focused)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Eq, Default, Clone, Copy)]
|
||||
|
@ -31,6 +40,7 @@ pub enum AutoscrollStrategy {
|
|||
Newest,
|
||||
#[default]
|
||||
Center,
|
||||
Focused,
|
||||
Top,
|
||||
Bottom,
|
||||
}
|
||||
|
@ -155,6 +165,11 @@ impl Editor {
|
|||
scroll_position.y = (target_top - margin).max(0.0);
|
||||
self.set_scroll_position_internal(scroll_position, local, true, cx);
|
||||
}
|
||||
AutoscrollStrategy::Focused => {
|
||||
scroll_position.y =
|
||||
(target_top - self.scroll_manager.vertical_scroll_margin).max(0.0);
|
||||
self.set_scroll_position_internal(scroll_position, local, true, cx);
|
||||
}
|
||||
AutoscrollStrategy::Top => {
|
||||
scroll_position.y = (target_top).max(0.0);
|
||||
self.set_scroll_position_internal(scroll_position, local, true, cx);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue