From 14ac10547c2bcddbcc65835005f6282ae97744c8 Mon Sep 17 00:00:00 2001 From: veeso Date: Wed, 2 Oct 2024 12:34:00 +0200 Subject: [PATCH] fix: don't clear screen after terminating termscp --- CHANGELOG.md | 1 + src/ui/context.rs | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dfc4c42..f78e10d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,7 @@ Released on - [Issue 268](https://github.com/veeso/termscp/issues/268): Pods and container explorer for Kube protocol. - BREAKING ‼️ Kube address argument has changed; see manual! - Pod and container argumets have been removed; from now on you will connect with the following syntax to the provided namespace: `/pod-name/container-name/path/to/file` +- [Issue 279](https://github.com/veeso/termscp/issues/279): do not clear screen ## 0.14.0 diff --git a/src/ui/context.rs b/src/ui/context.rs index 7ad66ee..46c0887 100644 --- a/src/ui/context.rs +++ b/src/ui/context.rs @@ -30,7 +30,7 @@ impl Context { theme_provider: ThemeProvider, error: Option, ) -> Context { - Context { + let mut ctx = Context { bookmarks_client, config_client, ft_params: None, @@ -38,7 +38,13 @@ impl Context { terminal: TerminalBridge::new().expect("Could not initialize terminal"), theme_provider, error, - } + }; + + // Init terminal state + let _ = ctx.terminal.enable_raw_mode(); + let _ = ctx.terminal.enter_alternate_screen(); + + ctx } // -- getters @@ -107,6 +113,5 @@ impl Drop for Context { // Re-enable terminal stuff let _ = self.terminal.disable_raw_mode(); let _ = self.terminal.leave_alternate_screen(); - let _ = self.terminal.clear_screen(); } }