aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
authordenis <denismaximov98@gmail.com>2021-01-29 06:24:59 +0200
committerdenis <denismaximov98@gmail.com>2021-01-29 06:24:59 +0200
commit6a3481f54f0ee789ceeb994d8f302e3ce119c031 (patch)
tree60d4ad8d08c2349571d29d68c357ac07c6acce63 /src/main.rs
parentwip: oops shouldn't forget that (diff)
parentfeat(statusbar): max status bar height (#156) (diff)
downloadsl0ppij-6a3481f54f0ee789ceeb994d8f302e3ce119c031.tar.gz
sl0ppij-6a3481f54f0ee789ceeb994d8f302e3ce119c031.tar.xz
sl0ppij-6a3481f54f0ee789ceeb994d8f302e3ce119c031.zip
Merge branch 'main' into restructure
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs
index 245cca96..716c2694 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -167,6 +167,12 @@ pub enum AppInstruction {
}
pub fn start(mut os_input: Box<dyn OsApi>, opts: CliArgs) {
+ let take_snapshot = "\u{1b}[?1049h";
+ os_input.unset_raw_mode(0);
+ let _ = os_input
+ .get_stdout_writer()
+ .write(take_snapshot.as_bytes())
+ .unwrap();
let mut app_state = AppState::default();
let command_is_executing = CommandIsExecuting::new();
@@ -203,6 +209,7 @@ pub fn start(mut os_input: Box<dyn OsApi>, opts: CliArgs) {
os_input.clone(),
opts.debug,
);
+
// Don't use default layouts in tests, but do everywhere else
#[cfg(not(test))]
let default_layout = Some(PathBuf::from("default"));
@@ -393,6 +400,12 @@ pub fn start(mut os_input: Box<dyn OsApi>, opts: CliArgs) {
// FIXME: Is this needed?
screen.render();
}
+ ScreenInstruction::SetMaxHeight(id, max_height) => {
+ screen
+ .get_active_tab_mut()
+ .unwrap()
+ .set_pane_max_height(id, max_height);
+ }
ScreenInstruction::ClosePane(id) => {
screen.get_active_tab_mut().unwrap().close_pane(id);
screen.render();
@@ -677,10 +690,11 @@ pub fn start(mut os_input: Box<dyn OsApi>, opts: CliArgs) {
// cleanup();
let reset_style = "\u{1b}[m";
let show_cursor = "\u{1b}[?25h";
+ let restore_snapshot = "\u{1b}[?1049l";
let goto_start_of_last_line = format!("\u{1b}[{};{}H", full_screen_ws.rows, 1);
let goodbye_message = format!(
- "{}\n{}{}Bye from Mosaic!",
- goto_start_of_last_line, reset_style, show_cursor
+ "{}\n{}{}{}Bye from Mosaic!",
+ goto_start_of_last_line, restore_snapshot, reset_style, show_cursor
);
os_input.unset_raw_mode(0);