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:
Conrad Irwin 2024-02-01 22:22:02 -07:00 committed by GitHub
parent b35a7223b6
commit 69e0ea92e4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 260 additions and 65 deletions

View file

@ -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);