Checkpoint - Still Broken
This commit is contained in:
parent
bca97f7186
commit
58650b7d2d
31 changed files with 298 additions and 213 deletions
|
@ -4,12 +4,12 @@ use std::str::FromStr;
|
|||
use gpui3::WindowContext;
|
||||
use rand::Rng;
|
||||
|
||||
use crate::HighlightedText;
|
||||
use crate::{
|
||||
theme, Buffer, BufferRow, BufferRows, EditorPane, FileSystemStatus, GitStatus, HighlightColor,
|
||||
HighlightedLine, HighlightedText, Icon, Keybinding, Label, LabelColor, ListEntry,
|
||||
ListEntrySize, ListItem, Livestream, MicStatus, ModifierKeys, PaletteItem, Player,
|
||||
PlayerCallStatus, PlayerWithCallStatus, ScreenShareStatus, Symbol, Tab, Theme, ToggleState,
|
||||
VideoStatus,
|
||||
Buffer, BufferRow, BufferRows, EditorPane, FileSystemStatus, GitStatus, HighlightedLine, Icon,
|
||||
Keybinding, Label, LabelColor, ListEntry, ListEntrySize, ListItem, Livestream, MicStatus,
|
||||
ModifierKeys, PaletteItem, Player, PlayerCallStatus, PlayerWithCallStatus, ScreenShareStatus,
|
||||
Symbol, Tab, ThemeColor, ToggleState, VideoStatus,
|
||||
};
|
||||
|
||||
pub fn static_tabs_example<S: 'static + Send + Sync + Clone>() -> Vec<Tab<S>> {
|
||||
|
@ -613,7 +613,7 @@ pub fn empty_buffer_example<S: 'static + Send + Sync + Clone>() -> Buffer<S> {
|
|||
}
|
||||
|
||||
pub fn hello_world_rust_editor_example(cx: &mut WindowContext) -> EditorPane {
|
||||
let theme = theme(cx);
|
||||
let color = ThemeColor::new(cx);
|
||||
|
||||
EditorPane::new(
|
||||
cx,
|
||||
|
@ -622,19 +622,19 @@ pub fn hello_world_rust_editor_example(cx: &mut WindowContext) -> EditorPane {
|
|||
vec![Symbol(vec![
|
||||
HighlightedText {
|
||||
text: "fn ".to_string(),
|
||||
color: HighlightColor::Keyword.hsla(&theme),
|
||||
color: color.syntax.keyword,
|
||||
},
|
||||
HighlightedText {
|
||||
text: "main".to_string(),
|
||||
color: HighlightColor::Function.hsla(&theme),
|
||||
color: color.syntax.function,
|
||||
},
|
||||
])],
|
||||
hello_world_rust_buffer_example(&theme),
|
||||
hello_world_rust_buffer_example(&color),
|
||||
)
|
||||
}
|
||||
|
||||
pub fn hello_world_rust_buffer_example<S: 'static + Send + Sync + Clone>(
|
||||
theme: &Theme,
|
||||
color: &ThemeColor,
|
||||
) -> Buffer<S> {
|
||||
Buffer::new()
|
||||
.set_title("hello_world.rs".to_string())
|
||||
|
@ -642,11 +642,11 @@ pub fn hello_world_rust_buffer_example<S: 'static + Send + Sync + Clone>(
|
|||
.set_language("rust".to_string())
|
||||
.set_rows(Some(BufferRows {
|
||||
show_line_numbers: true,
|
||||
rows: hello_world_rust_buffer_rows(theme),
|
||||
rows: hello_world_rust_buffer_rows(color),
|
||||
}))
|
||||
}
|
||||
|
||||
pub fn hello_world_rust_buffer_rows(theme: &Theme) -> Vec<BufferRow> {
|
||||
pub fn hello_world_rust_buffer_rows(color: &ThemeColor) -> Vec<BufferRow> {
|
||||
let show_line_number = true;
|
||||
|
||||
vec![
|
||||
|
@ -658,15 +658,15 @@ pub fn hello_world_rust_buffer_rows(theme: &Theme) -> Vec<BufferRow> {
|
|||
highlighted_texts: vec![
|
||||
HighlightedText {
|
||||
text: "fn ".to_string(),
|
||||
color: HighlightColor::Keyword.hsla(&theme),
|
||||
color: color.syntax.keyword,
|
||||
},
|
||||
HighlightedText {
|
||||
text: "main".to_string(),
|
||||
color: HighlightColor::Function.hsla(&theme),
|
||||
color: color.syntax.function,
|
||||
},
|
||||
HighlightedText {
|
||||
text: "() {".to_string(),
|
||||
color: HighlightColor::Default.hsla(&theme),
|
||||
color: color.text,
|
||||
},
|
||||
],
|
||||
}),
|
||||
|
@ -682,7 +682,7 @@ pub fn hello_world_rust_buffer_rows(theme: &Theme) -> Vec<BufferRow> {
|
|||
highlighted_texts: vec![HighlightedText {
|
||||
text: " // Statements here are executed when the compiled binary is called."
|
||||
.to_string(),
|
||||
color: HighlightColor::Comment.hsla(&theme),
|
||||
color: color.syntax.comment,
|
||||
}],
|
||||
}),
|
||||
cursors: None,
|
||||
|
@ -705,7 +705,7 @@ pub fn hello_world_rust_buffer_rows(theme: &Theme) -> Vec<BufferRow> {
|
|||
line: Some(HighlightedLine {
|
||||
highlighted_texts: vec![HighlightedText {
|
||||
text: " // Print text to the console.".to_string(),
|
||||
color: HighlightColor::Comment.hsla(&theme),
|
||||
color: color.syntax.comment,
|
||||
}],
|
||||
}),
|
||||
cursors: None,
|
||||
|
@ -720,15 +720,15 @@ pub fn hello_world_rust_buffer_rows(theme: &Theme) -> Vec<BufferRow> {
|
|||
highlighted_texts: vec![
|
||||
HighlightedText {
|
||||
text: " println!(".to_string(),
|
||||
color: HighlightColor::Default.hsla(&theme),
|
||||
color: color.text,
|
||||
},
|
||||
HighlightedText {
|
||||
text: "\"Hello, world!\"".to_string(),
|
||||
color: HighlightColor::String.hsla(&theme),
|
||||
color: color.syntax.string,
|
||||
},
|
||||
HighlightedText {
|
||||
text: ");".to_string(),
|
||||
color: HighlightColor::Default.hsla(&theme),
|
||||
color: color.text,
|
||||
},
|
||||
],
|
||||
}),
|
||||
|
@ -743,7 +743,7 @@ pub fn hello_world_rust_buffer_rows(theme: &Theme) -> Vec<BufferRow> {
|
|||
line: Some(HighlightedLine {
|
||||
highlighted_texts: vec![HighlightedText {
|
||||
text: "}".to_string(),
|
||||
color: HighlightColor::Default.hsla(&theme),
|
||||
color: color.text,
|
||||
}],
|
||||
}),
|
||||
cursors: None,
|
||||
|
@ -754,7 +754,7 @@ pub fn hello_world_rust_buffer_rows(theme: &Theme) -> Vec<BufferRow> {
|
|||
}
|
||||
|
||||
pub fn hello_world_rust_editor_with_status_example(cx: &mut WindowContext) -> EditorPane {
|
||||
let theme = theme(cx);
|
||||
let color = ThemeColor::new(cx);
|
||||
|
||||
EditorPane::new(
|
||||
cx,
|
||||
|
@ -763,19 +763,19 @@ pub fn hello_world_rust_editor_with_status_example(cx: &mut WindowContext) -> Ed
|
|||
vec![Symbol(vec![
|
||||
HighlightedText {
|
||||
text: "fn ".to_string(),
|
||||
color: HighlightColor::Keyword.hsla(&theme),
|
||||
color: color.syntax.keyword,
|
||||
},
|
||||
HighlightedText {
|
||||
text: "main".to_string(),
|
||||
color: HighlightColor::Function.hsla(&theme),
|
||||
color: color.syntax.function,
|
||||
},
|
||||
])],
|
||||
hello_world_rust_buffer_with_status_example(&theme),
|
||||
hello_world_rust_buffer_with_status_example(&color),
|
||||
)
|
||||
}
|
||||
|
||||
pub fn hello_world_rust_buffer_with_status_example<S: 'static + Send + Sync + Clone>(
|
||||
theme: &Theme,
|
||||
color: &ThemeColor,
|
||||
) -> Buffer<S> {
|
||||
Buffer::new()
|
||||
.set_title("hello_world.rs".to_string())
|
||||
|
@ -783,11 +783,11 @@ pub fn hello_world_rust_buffer_with_status_example<S: 'static + Send + Sync + Cl
|
|||
.set_language("rust".to_string())
|
||||
.set_rows(Some(BufferRows {
|
||||
show_line_numbers: true,
|
||||
rows: hello_world_rust_with_status_buffer_rows(theme),
|
||||
rows: hello_world_rust_with_status_buffer_rows(color),
|
||||
}))
|
||||
}
|
||||
|
||||
pub fn hello_world_rust_with_status_buffer_rows(theme: &Theme) -> Vec<BufferRow> {
|
||||
pub fn hello_world_rust_with_status_buffer_rows(color: &ThemeColor) -> Vec<BufferRow> {
|
||||
let show_line_number = true;
|
||||
|
||||
vec![
|
||||
|
@ -799,15 +799,15 @@ pub fn hello_world_rust_with_status_buffer_rows(theme: &Theme) -> Vec<BufferRow>
|
|||
highlighted_texts: vec![
|
||||
HighlightedText {
|
||||
text: "fn ".to_string(),
|
||||
color: HighlightColor::Keyword.hsla(&theme),
|
||||
color: color.syntax.keyword,
|
||||
},
|
||||
HighlightedText {
|
||||
text: "main".to_string(),
|
||||
color: HighlightColor::Function.hsla(&theme),
|
||||
color: color.syntax.function,
|
||||
},
|
||||
HighlightedText {
|
||||
text: "() {".to_string(),
|
||||
color: HighlightColor::Default.hsla(&theme),
|
||||
color: color.text,
|
||||
},
|
||||
],
|
||||
}),
|
||||
|
@ -823,7 +823,7 @@ pub fn hello_world_rust_with_status_buffer_rows(theme: &Theme) -> Vec<BufferRow>
|
|||
highlighted_texts: vec![HighlightedText {
|
||||
text: "// Statements here are executed when the compiled binary is called."
|
||||
.to_string(),
|
||||
color: HighlightColor::Comment.hsla(&theme),
|
||||
color: color.syntax.comment,
|
||||
}],
|
||||
}),
|
||||
cursors: None,
|
||||
|
@ -846,7 +846,7 @@ pub fn hello_world_rust_with_status_buffer_rows(theme: &Theme) -> Vec<BufferRow>
|
|||
line: Some(HighlightedLine {
|
||||
highlighted_texts: vec![HighlightedText {
|
||||
text: " // Print text to the console.".to_string(),
|
||||
color: HighlightColor::Comment.hsla(&theme),
|
||||
color: color.syntax.comment,
|
||||
}],
|
||||
}),
|
||||
cursors: None,
|
||||
|
@ -861,15 +861,15 @@ pub fn hello_world_rust_with_status_buffer_rows(theme: &Theme) -> Vec<BufferRow>
|
|||
highlighted_texts: vec![
|
||||
HighlightedText {
|
||||
text: " println!(".to_string(),
|
||||
color: HighlightColor::Default.hsla(&theme),
|
||||
color: color.text,
|
||||
},
|
||||
HighlightedText {
|
||||
text: "\"Hello, world!\"".to_string(),
|
||||
color: HighlightColor::String.hsla(&theme),
|
||||
color: color.syntax.string,
|
||||
},
|
||||
HighlightedText {
|
||||
text: ");".to_string(),
|
||||
color: HighlightColor::Default.hsla(&theme),
|
||||
color: color.text,
|
||||
},
|
||||
],
|
||||
}),
|
||||
|
@ -884,7 +884,7 @@ pub fn hello_world_rust_with_status_buffer_rows(theme: &Theme) -> Vec<BufferRow>
|
|||
line: Some(HighlightedLine {
|
||||
highlighted_texts: vec![HighlightedText {
|
||||
text: "}".to_string(),
|
||||
color: HighlightColor::Default.hsla(&theme),
|
||||
color: color.text,
|
||||
}],
|
||||
}),
|
||||
cursors: None,
|
||||
|
@ -898,7 +898,7 @@ pub fn hello_world_rust_with_status_buffer_rows(theme: &Theme) -> Vec<BufferRow>
|
|||
line: Some(HighlightedLine {
|
||||
highlighted_texts: vec![HighlightedText {
|
||||
text: "".to_string(),
|
||||
color: HighlightColor::Default.hsla(&theme),
|
||||
color: color.text,
|
||||
}],
|
||||
}),
|
||||
cursors: None,
|
||||
|
@ -912,7 +912,7 @@ pub fn hello_world_rust_with_status_buffer_rows(theme: &Theme) -> Vec<BufferRow>
|
|||
line: Some(HighlightedLine {
|
||||
highlighted_texts: vec![HighlightedText {
|
||||
text: "// Marshall and Nate were here".to_string(),
|
||||
color: HighlightColor::Comment.hsla(&theme),
|
||||
color: color.syntax.comment,
|
||||
}],
|
||||
}),
|
||||
cursors: None,
|
||||
|
@ -922,16 +922,16 @@ pub fn hello_world_rust_with_status_buffer_rows(theme: &Theme) -> Vec<BufferRow>
|
|||
]
|
||||
}
|
||||
|
||||
pub fn terminal_buffer<S: 'static + Send + Sync + Clone>(theme: &Theme) -> Buffer<S> {
|
||||
pub fn terminal_buffer<S: 'static + Send + Sync + Clone>(color: &ThemeColor) -> Buffer<S> {
|
||||
Buffer::new()
|
||||
.set_title("zed — fish".to_string())
|
||||
.set_rows(Some(BufferRows {
|
||||
show_line_numbers: false,
|
||||
rows: terminal_buffer_rows(theme),
|
||||
rows: terminal_buffer_rows(color),
|
||||
}))
|
||||
}
|
||||
|
||||
pub fn terminal_buffer_rows(theme: &Theme) -> Vec<BufferRow> {
|
||||
pub fn terminal_buffer_rows(color: &ThemeColor) -> Vec<BufferRow> {
|
||||
let show_line_number = false;
|
||||
|
||||
vec![
|
||||
|
@ -943,31 +943,31 @@ pub fn terminal_buffer_rows(theme: &Theme) -> Vec<BufferRow> {
|
|||
highlighted_texts: vec![
|
||||
HighlightedText {
|
||||
text: "maxdeviant ".to_string(),
|
||||
color: HighlightColor::Keyword.hsla(&theme),
|
||||
color: color.syntax.keyword,
|
||||
},
|
||||
HighlightedText {
|
||||
text: "in ".to_string(),
|
||||
color: HighlightColor::Default.hsla(&theme),
|
||||
color: color.text,
|
||||
},
|
||||
HighlightedText {
|
||||
text: "profaned-capital ".to_string(),
|
||||
color: HighlightColor::Function.hsla(&theme),
|
||||
color: color.syntax.function,
|
||||
},
|
||||
HighlightedText {
|
||||
text: "in ".to_string(),
|
||||
color: HighlightColor::Default.hsla(&theme),
|
||||
color: color.text,
|
||||
},
|
||||
HighlightedText {
|
||||
text: "~/p/zed ".to_string(),
|
||||
color: HighlightColor::Function.hsla(&theme),
|
||||
color: color.syntax.function,
|
||||
},
|
||||
HighlightedText {
|
||||
text: "on ".to_string(),
|
||||
color: HighlightColor::Default.hsla(&theme),
|
||||
color: color.text,
|
||||
},
|
||||
HighlightedText {
|
||||
text: " gpui2-ui ".to_string(),
|
||||
color: HighlightColor::Keyword.hsla(&theme),
|
||||
color: color.syntax.keyword,
|
||||
},
|
||||
],
|
||||
}),
|
||||
|
@ -982,7 +982,7 @@ pub fn terminal_buffer_rows(theme: &Theme) -> Vec<BufferRow> {
|
|||
line: Some(HighlightedLine {
|
||||
highlighted_texts: vec![HighlightedText {
|
||||
text: "λ ".to_string(),
|
||||
color: HighlightColor::String.hsla(&theme),
|
||||
color: color.syntax.string,
|
||||
}],
|
||||
}),
|
||||
cursors: None,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue