mirror of
https://github.com/veeso/termscp.git
synced 2025-12-07 09:36:00 -08:00
Context cleanup
This commit is contained in:
@@ -33,8 +33,8 @@ use crate::host::Localhost;
|
|||||||
|
|
||||||
// Includes
|
// Includes
|
||||||
use crossterm::execute;
|
use crossterm::execute;
|
||||||
use crossterm::event::EnableMouseCapture;
|
use crossterm::event::{EnableMouseCapture, DisableMouseCapture};
|
||||||
use crossterm::terminal::{EnterAlternateScreen};
|
use crossterm::terminal::{EnterAlternateScreen, LeaveAlternateScreen};
|
||||||
use std::io::{stdout, Stdout, Write};
|
use std::io::{stdout, Stdout, Write};
|
||||||
use tui::backend::CrosstermBackend;
|
use tui::backend::CrosstermBackend;
|
||||||
use tui::Terminal;
|
use tui::Terminal;
|
||||||
@@ -64,6 +64,18 @@ impl Context {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Drop for Context {
|
||||||
|
fn drop(&mut self) {
|
||||||
|
// Re-enable terminal stuff
|
||||||
|
let _ = execute!(
|
||||||
|
self.terminal.backend_mut(),
|
||||||
|
LeaveAlternateScreen,
|
||||||
|
DisableMouseCapture
|
||||||
|
);
|
||||||
|
drop(self);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
|||||||
Reference in New Issue
Block a user