Repository navigation
Expand file tree
/
Copy pathapp.rs
More file actions
76 lines (68 loc) · 2.08 KB
/
Copy pathapp.rs
File metadata and controls
76 lines (68 loc) · 2.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
use crate::git::diff::{ChangedFile, RepoSnapshot};
mod app_impl;
mod git;
mod navigation;
mod session_io;
#[cfg(test)]
pub use crate::runtime::snapshot::SnapshotChannel;
pub use crate::runtime::snapshot::SnapshotMsg;
#[cfg(test)]
pub use crate::runtime::terminal::PaneInfo;
pub use crate::runtime::terminal::TerminalState;
#[cfg(test)]
pub(crate) use crate::runtime::terminal::strip_escape_sequences;
pub use crate::ui::diff_pane::DiffPaneView;
pub use crate::ui::file_view::{FileViewKey, FileViewState};
pub use git::GitViewManager;
#[cfg(test)]
pub use git::RepositoryView;
pub(crate) use navigation::interaction::{InteractionState, leader_label_of};
pub(crate) const LIST_PAGE_SIZE: usize = 10;
pub(crate) const DIFF_PAGE_SIZE: usize = 20;
// Keying expiry on the variant (not message text) forces a decision about
// when each new kind goes away.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum NoticeKind {
Git,
Diff,
Terminal,
Tree,
Session,
RepoInput,
Project,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Notice {
pub kind: NoticeKind,
pub text: String,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize, Default)]
pub enum ViewMode {
#[default]
Status,
Log,
Tree,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum Focus {
FileList,
DiffViewer,
Terminal,
}
pub struct App {
pub(crate) git: GitViewManager,
pub focus: Focus,
pub notice: Option<Notice>,
pub terminal: TerminalState,
// Terminal focus, active pane, and fullscreen waiting on the panes.
//
// Panes belong to the session, so a fresh view has none until the daemon
// reports them. A fresh launch starts with the default here and a restored
// session replaces it with what was saved.
pub(crate) pending_terminal: Option<crate::workspace::persistence::SessionState>,
// Mutually exclusive with `diff.fullscreen` and `terminal.fullscreen`.
pub list_fullscreen: bool,
pub(crate) interaction: InteractionState,
}
#[cfg(test)]
pub(crate) mod tests;