1use std::path::PathBuf;
2use std::str::FromStr;
3
4use rand::Rng;
5
6use crate::{
7 Buffer, BufferRow, BufferRows, Editor, FileSystemStatus, GitStatus, HighlightColor,
8 HighlightedLine, HighlightedText, Icon, Label, LabelColor, ListEntry, ListItem, Livestream,
9 MicStatus, Player, PlayerCallStatus, PlayerWithCallStatus, ScreenShareStatus, Symbol, Tab,
10 Theme, ToggleState, VideoStatus,
11};
12
13pub fn static_tabs_example<S: 'static + Send + Sync + Clone>() -> Vec<Tab<S>> {
14 vec![
15 Tab::new()
16 .title("wip.rs".to_string())
17 .icon(Icon::FileRust)
18 .current(false)
19 .fs_status(FileSystemStatus::Deleted),
20 Tab::new()
21 .title("Cargo.toml".to_string())
22 .icon(Icon::FileToml)
23 .current(false)
24 .git_status(GitStatus::Modified),
25 Tab::new()
26 .title("Channels Panel".to_string())
27 .icon(Icon::Hash)
28 .current(false),
29 Tab::new()
30 .title("channels_panel.rs".to_string())
31 .icon(Icon::FileRust)
32 .current(true)
33 .git_status(GitStatus::Modified),
34 Tab::new()
35 .title("workspace.rs".to_string())
36 .current(false)
37 .icon(Icon::FileRust)
38 .git_status(GitStatus::Modified),
39 Tab::new()
40 .title("icon_button.rs".to_string())
41 .icon(Icon::FileRust)
42 .current(false),
43 Tab::new()
44 .title("storybook.rs".to_string())
45 .icon(Icon::FileRust)
46 .current(false)
47 .git_status(GitStatus::Created),
48 Tab::new()
49 .title("theme.rs".to_string())
50 .icon(Icon::FileRust)
51 .current(false),
52 Tab::new()
53 .title("theme_registry.rs".to_string())
54 .icon(Icon::FileRust)
55 .current(false),
56 Tab::new()
57 .title("styleable_helpers.rs".to_string())
58 .icon(Icon::FileRust)
59 .current(false),
60 ]
61}
62
63pub fn static_tabs_1<S: 'static + Send + Sync + Clone>() -> Vec<Tab<S>> {
64 vec![
65 Tab::new()
66 .title("project_panel.rs".to_string())
67 .icon(Icon::FileRust)
68 .current(false)
69 .fs_status(FileSystemStatus::Deleted),
70 Tab::new()
71 .title("tab_bar.rs".to_string())
72 .icon(Icon::FileRust)
73 .current(false)
74 .git_status(GitStatus::Modified),
75 Tab::new()
76 .title("workspace.rs".to_string())
77 .icon(Icon::FileRust)
78 .current(false),
79 Tab::new()
80 .title("tab.rs".to_string())
81 .icon(Icon::FileRust)
82 .current(true)
83 .git_status(GitStatus::Modified),
84 ]
85}
86
87pub fn static_tabs_2<S: 'static + Send + Sync + Clone>() -> Vec<Tab<S>> {
88 vec![
89 Tab::new()
90 .title("tab_bar.rs".to_string())
91 .icon(Icon::FileRust)
92 .current(false)
93 .fs_status(FileSystemStatus::Deleted),
94 Tab::new()
95 .title("static_data.rs".to_string())
96 .icon(Icon::FileRust)
97 .current(true)
98 .git_status(GitStatus::Modified),
99 ]
100}
101
102pub fn static_tabs_3<S: 'static + Send + Sync + Clone>() -> Vec<Tab<S>> {
103 vec![Tab::new().git_status(GitStatus::Created).current(true)]
104}
105
106pub fn static_players() -> Vec<Player> {
107 vec![
108 Player::new(
109 0,
110 "https://avatars.githubusercontent.com/u/1714999?v=4".into(),
111 "nathansobo".into(),
112 ),
113 Player::new(
114 1,
115 "https://avatars.githubusercontent.com/u/326587?v=4".into(),
116 "maxbrunsfeld".into(),
117 ),
118 Player::new(
119 2,
120 "https://avatars.githubusercontent.com/u/482957?v=4".into(),
121 "as-cii".into(),
122 ),
123 Player::new(
124 3,
125 "https://avatars.githubusercontent.com/u/1714999?v=4".into(),
126 "iamnbutler".into(),
127 ),
128 Player::new(
129 4,
130 "https://avatars.githubusercontent.com/u/1486634?v=4".into(),
131 "maxdeviant".into(),
132 ),
133 ]
134}
135
136#[derive(Debug)]
137pub struct PlayerData {
138 pub url: String,
139 pub name: String,
140}
141
142pub fn static_player_data() -> Vec<PlayerData> {
143 vec![
144 PlayerData {
145 url: "https://avatars.githubusercontent.com/u/1714999?v=4".into(),
146 name: "iamnbutler".into(),
147 },
148 PlayerData {
149 url: "https://avatars.githubusercontent.com/u/326587?v=4".into(),
150 name: "maxbrunsfeld".into(),
151 },
152 PlayerData {
153 url: "https://avatars.githubusercontent.com/u/482957?v=4".into(),
154 name: "as-cii".into(),
155 },
156 PlayerData {
157 url: "https://avatars.githubusercontent.com/u/1789?v=4".into(),
158 name: "nathansobo".into(),
159 },
160 PlayerData {
161 url: "https://avatars.githubusercontent.com/u/1486634?v=4".into(),
162 name: "ForLoveOfCats".into(),
163 },
164 PlayerData {
165 url: "https://avatars.githubusercontent.com/u/2690773?v=4".into(),
166 name: "SomeoneToIgnore".into(),
167 },
168 PlayerData {
169 url: "https://avatars.githubusercontent.com/u/19867440?v=4".into(),
170 name: "JosephTLyons".into(),
171 },
172 PlayerData {
173 url: "https://avatars.githubusercontent.com/u/24362066?v=4".into(),
174 name: "osiewicz".into(),
175 },
176 PlayerData {
177 url: "https://avatars.githubusercontent.com/u/22121886?v=4".into(),
178 name: "KCaverly".into(),
179 },
180 PlayerData {
181 url: "https://avatars.githubusercontent.com/u/1486634?v=4".into(),
182 name: "maxdeviant".into(),
183 },
184 ]
185}
186
187pub fn create_static_players(player_data: Vec<PlayerData>) -> Vec<Player> {
188 let mut players = Vec::new();
189 for data in player_data {
190 players.push(Player::new(players.len(), data.url, data.name));
191 }
192 players
193}
194
195pub fn static_player_1(data: &Vec<PlayerData>) -> Player {
196 Player::new(1, data[0].url.clone(), data[0].name.clone())
197}
198
199pub fn static_player_2(data: &Vec<PlayerData>) -> Player {
200 Player::new(2, data[1].url.clone(), data[1].name.clone())
201}
202
203pub fn static_player_3(data: &Vec<PlayerData>) -> Player {
204 Player::new(3, data[2].url.clone(), data[2].name.clone())
205}
206
207pub fn static_player_4(data: &Vec<PlayerData>) -> Player {
208 Player::new(4, data[3].url.clone(), data[3].name.clone())
209}
210
211pub fn static_player_5(data: &Vec<PlayerData>) -> Player {
212 Player::new(5, data[4].url.clone(), data[4].name.clone())
213}
214
215pub fn static_player_6(data: &Vec<PlayerData>) -> Player {
216 Player::new(6, data[5].url.clone(), data[5].name.clone())
217}
218
219pub fn static_player_7(data: &Vec<PlayerData>) -> Player {
220 Player::new(7, data[6].url.clone(), data[6].name.clone())
221}
222
223pub fn static_player_8(data: &Vec<PlayerData>) -> Player {
224 Player::new(8, data[7].url.clone(), data[7].name.clone())
225}
226
227pub fn static_player_9(data: &Vec<PlayerData>) -> Player {
228 Player::new(9, data[8].url.clone(), data[8].name.clone())
229}
230
231pub fn static_player_10(data: &Vec<PlayerData>) -> Player {
232 Player::new(10, data[9].url.clone(), data[9].name.clone())
233}
234
235pub fn static_livestream() -> Livestream {
236 Livestream {
237 players: random_players_with_call_status(7),
238 channel: Some("gpui2-ui".to_string()),
239 }
240}
241
242pub fn populate_player_call_status(
243 player: Player,
244 followers: Option<Vec<Player>>,
245) -> PlayerCallStatus {
246 let mut rng = rand::thread_rng();
247 let in_current_project: bool = rng.gen();
248 let disconnected: bool = rng.gen();
249 let voice_activity: f32 = rng.gen();
250 let mic_status = if rng.gen_bool(0.5) {
251 MicStatus::Muted
252 } else {
253 MicStatus::Unmuted
254 };
255 let video_status = if rng.gen_bool(0.5) {
256 VideoStatus::On
257 } else {
258 VideoStatus::Off
259 };
260 let screen_share_status = if rng.gen_bool(0.5) {
261 ScreenShareStatus::Shared
262 } else {
263 ScreenShareStatus::NotShared
264 };
265 PlayerCallStatus {
266 mic_status,
267 voice_activity,
268 video_status,
269 screen_share_status,
270 in_current_project,
271 disconnected,
272 following: None,
273 followers,
274 }
275}
276
277pub fn random_players_with_call_status(number_of_players: usize) -> Vec<PlayerWithCallStatus> {
278 let players = create_static_players(static_player_data());
279 let mut player_status = vec![];
280 for i in 0..number_of_players {
281 let followers = if i == 0 {
282 Some(vec![
283 players[1].clone(),
284 players[3].clone(),
285 players[5].clone(),
286 players[6].clone(),
287 ])
288 } else if i == 1 {
289 Some(vec![players[2].clone(), players[6].clone()])
290 } else {
291 None
292 };
293 let call_status = populate_player_call_status(players[i].clone(), followers);
294 player_status.push(PlayerWithCallStatus::new(players[i].clone(), call_status));
295 }
296 player_status
297}
298
299pub fn static_players_with_call_status() -> Vec<PlayerWithCallStatus> {
300 let players = static_players();
301 let mut player_0_status = PlayerCallStatus::new();
302 let player_1_status = PlayerCallStatus::new();
303 let player_2_status = PlayerCallStatus::new();
304 let mut player_3_status = PlayerCallStatus::new();
305 let mut player_4_status = PlayerCallStatus::new();
306
307 player_0_status.screen_share_status = ScreenShareStatus::Shared;
308 player_0_status.followers = Some(vec![players[1].clone(), players[3].clone()]);
309
310 player_3_status.voice_activity = 0.5;
311 player_4_status.mic_status = MicStatus::Muted;
312 player_4_status.in_current_project = false;
313
314 vec![
315 PlayerWithCallStatus::new(players[0].clone(), player_0_status),
316 PlayerWithCallStatus::new(players[1].clone(), player_1_status),
317 PlayerWithCallStatus::new(players[2].clone(), player_2_status),
318 PlayerWithCallStatus::new(players[3].clone(), player_3_status),
319 PlayerWithCallStatus::new(players[4].clone(), player_4_status),
320 ]
321}
322
323pub fn static_project_panel_project_items<S: 'static + Send + Sync + Clone>() -> Vec<ListItem<S>> {
324 vec![
325 ListEntry::new(Label::new("zed"))
326 .left_icon(Icon::FolderOpen.into())
327 .indent_level(0)
328 .set_toggle(ToggleState::Toggled),
329 ListEntry::new(Label::new(".cargo"))
330 .left_icon(Icon::Folder.into())
331 .indent_level(1),
332 ListEntry::new(Label::new(".config"))
333 .left_icon(Icon::Folder.into())
334 .indent_level(1),
335 ListEntry::new(Label::new(".git").color(LabelColor::Hidden))
336 .left_icon(Icon::Folder.into())
337 .indent_level(1),
338 ListEntry::new(Label::new(".cargo"))
339 .left_icon(Icon::Folder.into())
340 .indent_level(1),
341 ListEntry::new(Label::new(".idea").color(LabelColor::Hidden))
342 .left_icon(Icon::Folder.into())
343 .indent_level(1),
344 ListEntry::new(Label::new("assets"))
345 .left_icon(Icon::Folder.into())
346 .indent_level(1)
347 .set_toggle(ToggleState::Toggled),
348 ListEntry::new(Label::new("cargo-target").color(LabelColor::Hidden))
349 .left_icon(Icon::Folder.into())
350 .indent_level(1),
351 ListEntry::new(Label::new("crates"))
352 .left_icon(Icon::FolderOpen.into())
353 .indent_level(1)
354 .set_toggle(ToggleState::Toggled),
355 ListEntry::new(Label::new("activity_indicator"))
356 .left_icon(Icon::Folder.into())
357 .indent_level(2),
358 ListEntry::new(Label::new("ai"))
359 .left_icon(Icon::Folder.into())
360 .indent_level(2),
361 ListEntry::new(Label::new("audio"))
362 .left_icon(Icon::Folder.into())
363 .indent_level(2),
364 ListEntry::new(Label::new("auto_update"))
365 .left_icon(Icon::Folder.into())
366 .indent_level(2),
367 ListEntry::new(Label::new("breadcrumbs"))
368 .left_icon(Icon::Folder.into())
369 .indent_level(2),
370 ListEntry::new(Label::new("call"))
371 .left_icon(Icon::Folder.into())
372 .indent_level(2),
373 ListEntry::new(Label::new("sqlez").color(LabelColor::Modified))
374 .left_icon(Icon::Folder.into())
375 .indent_level(2)
376 .set_toggle(ToggleState::NotToggled),
377 ListEntry::new(Label::new("gpui2"))
378 .left_icon(Icon::FolderOpen.into())
379 .indent_level(2)
380 .set_toggle(ToggleState::Toggled),
381 ListEntry::new(Label::new("src"))
382 .left_icon(Icon::FolderOpen.into())
383 .indent_level(3)
384 .set_toggle(ToggleState::Toggled),
385 ListEntry::new(Label::new("derive_element.rs"))
386 .left_icon(Icon::FileRust.into())
387 .indent_level(4),
388 ListEntry::new(Label::new("storybook").color(LabelColor::Modified))
389 .left_icon(Icon::FolderOpen.into())
390 .indent_level(1)
391 .set_toggle(ToggleState::Toggled),
392 ListEntry::new(Label::new("docs").color(LabelColor::Default))
393 .left_icon(Icon::Folder.into())
394 .indent_level(2)
395 .set_toggle(ToggleState::Toggled),
396 ListEntry::new(Label::new("src").color(LabelColor::Modified))
397 .left_icon(Icon::FolderOpen.into())
398 .indent_level(3)
399 .set_toggle(ToggleState::Toggled),
400 ListEntry::new(Label::new("ui").color(LabelColor::Modified))
401 .left_icon(Icon::FolderOpen.into())
402 .indent_level(4)
403 .set_toggle(ToggleState::Toggled),
404 ListEntry::new(Label::new("component").color(LabelColor::Created))
405 .left_icon(Icon::FolderOpen.into())
406 .indent_level(5)
407 .set_toggle(ToggleState::Toggled),
408 ListEntry::new(Label::new("facepile.rs").color(LabelColor::Default))
409 .left_icon(Icon::FileRust.into())
410 .indent_level(6),
411 ListEntry::new(Label::new("follow_group.rs").color(LabelColor::Default))
412 .left_icon(Icon::FileRust.into())
413 .indent_level(6),
414 ListEntry::new(Label::new("list_item.rs").color(LabelColor::Created))
415 .left_icon(Icon::FileRust.into())
416 .indent_level(6),
417 ListEntry::new(Label::new("tab.rs").color(LabelColor::Default))
418 .left_icon(Icon::FileRust.into())
419 .indent_level(6),
420 ListEntry::new(Label::new("target").color(LabelColor::Hidden))
421 .left_icon(Icon::Folder.into())
422 .indent_level(1),
423 ListEntry::new(Label::new(".dockerignore"))
424 .left_icon(Icon::FileGeneric.into())
425 .indent_level(1),
426 ListEntry::new(Label::new(".DS_Store").color(LabelColor::Hidden))
427 .left_icon(Icon::FileGeneric.into())
428 .indent_level(1),
429 ListEntry::new(Label::new("Cargo.lock"))
430 .left_icon(Icon::FileLock.into())
431 .indent_level(1),
432 ListEntry::new(Label::new("Cargo.toml"))
433 .left_icon(Icon::FileToml.into())
434 .indent_level(1),
435 ListEntry::new(Label::new("Dockerfile"))
436 .left_icon(Icon::FileGeneric.into())
437 .indent_level(1),
438 ListEntry::new(Label::new("Procfile"))
439 .left_icon(Icon::FileGeneric.into())
440 .indent_level(1),
441 ListEntry::new(Label::new("README.md"))
442 .left_icon(Icon::FileDoc.into())
443 .indent_level(1),
444 ]
445 .into_iter()
446 .map(From::from)
447 .collect()
448}
449
450pub fn static_project_panel_single_items<S: 'static + Send + Sync + Clone>() -> Vec<ListItem<S>> {
451 vec![
452 ListEntry::new(Label::new("todo.md"))
453 .left_icon(Icon::FileDoc.into())
454 .indent_level(0),
455 ListEntry::new(Label::new("README.md"))
456 .left_icon(Icon::FileDoc.into())
457 .indent_level(0),
458 ListEntry::new(Label::new("config.json"))
459 .left_icon(Icon::FileGeneric.into())
460 .indent_level(0),
461 ]
462 .into_iter()
463 .map(From::from)
464 .collect()
465}
466
467pub fn empty_editor_example<S: 'static + Send + Sync + Clone>() -> Editor<S> {
468 Editor {
469 tabs: static_tabs_example(),
470 path: PathBuf::from_str("crates/ui/src/static_data.rs").unwrap(),
471 symbols: vec![],
472 buffer: empty_buffer_example(),
473 }
474}
475
476pub fn empty_buffer_example<S: 'static + Send + Sync + Clone>() -> Buffer<S> {
477 Buffer::new().set_rows(Some(BufferRows::default()))
478}
479
480pub fn hello_world_rust_editor_example<S: 'static + Send + Sync + Clone>(
481 theme: &Theme,
482) -> Editor<S> {
483 Editor {
484 tabs: static_tabs_example(),
485 path: PathBuf::from_str("crates/ui/src/static_data.rs").unwrap(),
486 symbols: vec![Symbol(vec![
487 HighlightedText {
488 text: "fn ".to_string(),
489 color: HighlightColor::Keyword.hsla(&theme),
490 },
491 HighlightedText {
492 text: "main".to_string(),
493 color: HighlightColor::Function.hsla(&theme),
494 },
495 ])],
496 buffer: hello_world_rust_buffer_example(theme),
497 }
498}
499
500pub fn hello_world_rust_buffer_example<S: 'static + Send + Sync + Clone>(
501 theme: &Theme,
502) -> Buffer<S> {
503 Buffer::new()
504 .set_title("hello_world.rs".to_string())
505 .set_path("src/hello_world.rs".to_string())
506 .set_language("rust".to_string())
507 .set_rows(Some(BufferRows {
508 show_line_numbers: true,
509 rows: hello_world_rust_buffer_rows(theme),
510 }))
511}
512
513pub fn hello_world_rust_buffer_rows(theme: &Theme) -> Vec<BufferRow> {
514 let show_line_number = true;
515
516 vec![
517 BufferRow {
518 line_number: 1,
519 code_action: false,
520 current: true,
521 line: Some(HighlightedLine {
522 highlighted_texts: vec![
523 HighlightedText {
524 text: "fn ".to_string(),
525 color: HighlightColor::Keyword.hsla(&theme),
526 },
527 HighlightedText {
528 text: "main".to_string(),
529 color: HighlightColor::Function.hsla(&theme),
530 },
531 HighlightedText {
532 text: "() {".to_string(),
533 color: HighlightColor::Default.hsla(&theme),
534 },
535 ],
536 }),
537 cursors: None,
538 status: GitStatus::None,
539 show_line_number,
540 },
541 BufferRow {
542 line_number: 2,
543 code_action: false,
544 current: false,
545 line: Some(HighlightedLine {
546 highlighted_texts: vec![HighlightedText {
547 text: " // Statements here are executed when the compiled binary is called."
548 .to_string(),
549 color: HighlightColor::Comment.hsla(&theme),
550 }],
551 }),
552 cursors: None,
553 status: GitStatus::None,
554 show_line_number,
555 },
556 BufferRow {
557 line_number: 3,
558 code_action: false,
559 current: false,
560 line: None,
561 cursors: None,
562 status: GitStatus::None,
563 show_line_number,
564 },
565 BufferRow {
566 line_number: 4,
567 code_action: false,
568 current: false,
569 line: Some(HighlightedLine {
570 highlighted_texts: vec![HighlightedText {
571 text: " // Print text to the console.".to_string(),
572 color: HighlightColor::Comment.hsla(&theme),
573 }],
574 }),
575 cursors: None,
576 status: GitStatus::None,
577 show_line_number,
578 },
579 BufferRow {
580 line_number: 5,
581 code_action: false,
582 current: false,
583 line: Some(HighlightedLine {
584 highlighted_texts: vec![
585 HighlightedText {
586 text: " println!(".to_string(),
587 color: HighlightColor::Default.hsla(&theme),
588 },
589 HighlightedText {
590 text: "\"Hello, world!\"".to_string(),
591 color: HighlightColor::String.hsla(&theme),
592 },
593 HighlightedText {
594 text: ");".to_string(),
595 color: HighlightColor::Default.hsla(&theme),
596 },
597 ],
598 }),
599 cursors: None,
600 status: GitStatus::None,
601 show_line_number,
602 },
603 BufferRow {
604 line_number: 6,
605 code_action: false,
606 current: false,
607 line: Some(HighlightedLine {
608 highlighted_texts: vec![HighlightedText {
609 text: "}".to_string(),
610 color: HighlightColor::Default.hsla(&theme),
611 }],
612 }),
613 cursors: None,
614 status: GitStatus::None,
615 show_line_number,
616 },
617 ]
618}
619
620pub fn hello_world_rust_editor_with_status_example<S: 'static + Send + Sync + Clone>(
621 theme: &Theme,
622) -> Editor<S> {
623 Editor {
624 tabs: static_tabs_example(),
625 path: PathBuf::from_str("crates/ui/src/static_data.rs").unwrap(),
626 symbols: vec![Symbol(vec![
627 HighlightedText {
628 text: "fn ".to_string(),
629 color: HighlightColor::Keyword.hsla(&theme),
630 },
631 HighlightedText {
632 text: "main".to_string(),
633 color: HighlightColor::Function.hsla(&theme),
634 },
635 ])],
636 buffer: hello_world_rust_buffer_with_status_example(theme),
637 }
638}
639
640pub fn hello_world_rust_buffer_with_status_example<S: 'static + Send + Sync + Clone>(
641 theme: &Theme,
642) -> Buffer<S> {
643 Buffer::new()
644 .set_title("hello_world.rs".to_string())
645 .set_path("src/hello_world.rs".to_string())
646 .set_language("rust".to_string())
647 .set_rows(Some(BufferRows {
648 show_line_numbers: true,
649 rows: hello_world_rust_with_status_buffer_rows(theme),
650 }))
651}
652
653pub fn hello_world_rust_with_status_buffer_rows(theme: &Theme) -> Vec<BufferRow> {
654 let show_line_number = true;
655
656 vec![
657 BufferRow {
658 line_number: 1,
659 code_action: false,
660 current: true,
661 line: Some(HighlightedLine {
662 highlighted_texts: vec![
663 HighlightedText {
664 text: "fn ".to_string(),
665 color: HighlightColor::Keyword.hsla(&theme),
666 },
667 HighlightedText {
668 text: "main".to_string(),
669 color: HighlightColor::Function.hsla(&theme),
670 },
671 HighlightedText {
672 text: "() {".to_string(),
673 color: HighlightColor::Default.hsla(&theme),
674 },
675 ],
676 }),
677 cursors: None,
678 status: GitStatus::None,
679 show_line_number,
680 },
681 BufferRow {
682 line_number: 2,
683 code_action: false,
684 current: false,
685 line: Some(HighlightedLine {
686 highlighted_texts: vec![HighlightedText {
687 text: "// Statements here are executed when the compiled binary is called."
688 .to_string(),
689 color: HighlightColor::Comment.hsla(&theme),
690 }],
691 }),
692 cursors: None,
693 status: GitStatus::Modified,
694 show_line_number,
695 },
696 BufferRow {
697 line_number: 3,
698 code_action: false,
699 current: false,
700 line: None,
701 cursors: None,
702 status: GitStatus::None,
703 show_line_number,
704 },
705 BufferRow {
706 line_number: 4,
707 code_action: false,
708 current: false,
709 line: Some(HighlightedLine {
710 highlighted_texts: vec![HighlightedText {
711 text: " // Print text to the console.".to_string(),
712 color: HighlightColor::Comment.hsla(&theme),
713 }],
714 }),
715 cursors: None,
716 status: GitStatus::None,
717 show_line_number,
718 },
719 BufferRow {
720 line_number: 5,
721 code_action: false,
722 current: false,
723 line: Some(HighlightedLine {
724 highlighted_texts: vec![
725 HighlightedText {
726 text: " println!(".to_string(),
727 color: HighlightColor::Default.hsla(&theme),
728 },
729 HighlightedText {
730 text: "\"Hello, world!\"".to_string(),
731 color: HighlightColor::String.hsla(&theme),
732 },
733 HighlightedText {
734 text: ");".to_string(),
735 color: HighlightColor::Default.hsla(&theme),
736 },
737 ],
738 }),
739 cursors: None,
740 status: GitStatus::None,
741 show_line_number,
742 },
743 BufferRow {
744 line_number: 6,
745 code_action: false,
746 current: false,
747 line: Some(HighlightedLine {
748 highlighted_texts: vec![HighlightedText {
749 text: "}".to_string(),
750 color: HighlightColor::Default.hsla(&theme),
751 }],
752 }),
753 cursors: None,
754 status: GitStatus::None,
755 show_line_number,
756 },
757 BufferRow {
758 line_number: 7,
759 code_action: false,
760 current: false,
761 line: Some(HighlightedLine {
762 highlighted_texts: vec![HighlightedText {
763 text: "".to_string(),
764 color: HighlightColor::Default.hsla(&theme),
765 }],
766 }),
767 cursors: None,
768 status: GitStatus::Created,
769 show_line_number,
770 },
771 BufferRow {
772 line_number: 8,
773 code_action: false,
774 current: false,
775 line: Some(HighlightedLine {
776 highlighted_texts: vec![HighlightedText {
777 text: "// Marshall and Nate were here".to_string(),
778 color: HighlightColor::Comment.hsla(&theme),
779 }],
780 }),
781 cursors: None,
782 status: GitStatus::Created,
783 show_line_number,
784 },
785 ]
786}
787
788pub fn terminal_buffer<S: 'static + Send + Sync + Clone>(theme: &Theme) -> Buffer<S> {
789 Buffer::new()
790 .set_title("zed — fish".to_string())
791 .set_rows(Some(BufferRows {
792 show_line_numbers: false,
793 rows: terminal_buffer_rows(theme),
794 }))
795}
796
797pub fn terminal_buffer_rows(theme: &Theme) -> Vec<BufferRow> {
798 let show_line_number = false;
799
800 vec![
801 BufferRow {
802 line_number: 1,
803 code_action: false,
804 current: false,
805 line: Some(HighlightedLine {
806 highlighted_texts: vec![
807 HighlightedText {
808 text: "maxdeviant ".to_string(),
809 color: HighlightColor::Keyword.hsla(&theme),
810 },
811 HighlightedText {
812 text: "in ".to_string(),
813 color: HighlightColor::Default.hsla(&theme),
814 },
815 HighlightedText {
816 text: "profaned-capital ".to_string(),
817 color: HighlightColor::Function.hsla(&theme),
818 },
819 HighlightedText {
820 text: "in ".to_string(),
821 color: HighlightColor::Default.hsla(&theme),
822 },
823 HighlightedText {
824 text: "~/p/zed ".to_string(),
825 color: HighlightColor::Function.hsla(&theme),
826 },
827 HighlightedText {
828 text: "on ".to_string(),
829 color: HighlightColor::Default.hsla(&theme),
830 },
831 HighlightedText {
832 text: " gpui2-ui ".to_string(),
833 color: HighlightColor::Keyword.hsla(&theme),
834 },
835 ],
836 }),
837 cursors: None,
838 status: GitStatus::None,
839 show_line_number,
840 },
841 BufferRow {
842 line_number: 2,
843 code_action: false,
844 current: false,
845 line: Some(HighlightedLine {
846 highlighted_texts: vec![HighlightedText {
847 text: "λ ".to_string(),
848 color: HighlightColor::String.hsla(&theme),
849 }],
850 }),
851 cursors: None,
852 status: GitStatus::None,
853 show_line_number,
854 },
855 ]
856}