Fixed windows dying when opening text files
This commit is contained in:
parent
4475e8c24c
commit
5a4a364250
|
@ -35,6 +35,7 @@ Released on 21/06/2021
|
|||
- If the terminal window has less than 24 lines, then an error message is displayed in the auth activity
|
||||
- Changed auth layout to absolute sizes
|
||||
- Bugfix:
|
||||
- Fixed termscp on Windows dying whenever opening a file with text editor
|
||||
- Fixed broken input cursor when typing UTF8 characters (tui-realm 0.3.2)
|
||||
- Fixed [Issue 44](https://github.com/veeso/termscp/issues/44): Could not move files to other paths in FTP
|
||||
- Fixed [Issue 43](https://github.com/veeso/termscp/issues/43): Could not remove non-empty directories in FTP
|
||||
|
|
|
@ -113,6 +113,7 @@ impl FileTransferActivity {
|
|||
error!("Failed to disable raw mode: {}", err);
|
||||
}
|
||||
// Leave alternate mode
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
if let Some(ctx) = self.context.as_mut() {
|
||||
ctx.leave_alternate_screen();
|
||||
}
|
||||
|
@ -127,6 +128,7 @@ impl FileTransferActivity {
|
|||
),
|
||||
Err(err) => return Err(format!("Could not open editor: {}", err)),
|
||||
}
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
if let Some(ctx) = self.context.as_mut() {
|
||||
// Clear screen
|
||||
ctx.clear_screen();
|
||||
|
|
|
@ -115,6 +115,7 @@ impl SetupActivity {
|
|||
error!("Failed to disable raw mode: {}", err);
|
||||
}
|
||||
// Leave alternate mode
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
if let Some(ctx) = self.context.as_mut() {
|
||||
ctx.leave_alternate_screen();
|
||||
}
|
||||
|
@ -149,6 +150,7 @@ impl SetupActivity {
|
|||
}
|
||||
}
|
||||
// Restore terminal
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
if let Some(ctx) = self.context.as_mut() {
|
||||
// Clear screen
|
||||
ctx.clear_screen();
|
||||
|
|
|
@ -92,6 +92,7 @@ impl SetupActivity {
|
|||
error!("Failed to disable raw mode: {}", err);
|
||||
}
|
||||
// Leave alternate mode
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
ctx.leave_alternate_screen();
|
||||
// Get result
|
||||
let result: Result<(), String> = match ctx.config_client.as_ref() {
|
||||
|
@ -121,6 +122,7 @@ impl SetupActivity {
|
|||
// Clear screen
|
||||
ctx.clear_screen();
|
||||
// Enter alternate mode
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
ctx.enter_alternate_screen();
|
||||
// Re-enable raw mode
|
||||
if let Err(err) = enable_raw_mode() {
|
||||
|
|
|
@ -103,6 +103,7 @@ impl Context {
|
|||
/// ### enter_alternate_screen
|
||||
///
|
||||
/// Enter alternate screen (gui window)
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
pub fn enter_alternate_screen(&mut self) {
|
||||
match execute!(
|
||||
self.terminal.backend_mut(),
|
||||
|
@ -190,9 +191,12 @@ mod tests {
|
|||
assert!(ctx.get_error().is_some());
|
||||
assert!(ctx.get_error().is_none());
|
||||
// Try other methods
|
||||
ctx.enter_alternate_screen();
|
||||
ctx.clear_screen();
|
||||
ctx.leave_alternate_screen();
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
{
|
||||
ctx.enter_alternate_screen();
|
||||
ctx.clear_screen();
|
||||
ctx.leave_alternate_screen();
|
||||
}
|
||||
drop(ctx);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue