refactor: result return
This commit is contained in:
+3
-5
@@ -44,15 +44,14 @@ pub struct Ui {
|
|||||||
impl Ui {
|
impl Ui {
|
||||||
/// Enable mouse capture, but don't enable capture of all the mouse movements, doing so will improve performance, and is part of the fix for the weird mouse event output bug
|
/// Enable mouse capture, but don't enable capture of all the mouse movements, doing so will improve performance, and is part of the fix for the weird mouse event output bug
|
||||||
pub fn enable_mouse_capture() -> Result<()> {
|
pub fn enable_mouse_capture() -> Result<()> {
|
||||||
io::stdout().write_all(
|
Ok(io::stdout().write_all(
|
||||||
concat!(
|
concat!(
|
||||||
crossterm::csi!("?1000h"),
|
crossterm::csi!("?1000h"),
|
||||||
crossterm::csi!("?1015h"),
|
crossterm::csi!("?1015h"),
|
||||||
crossterm::csi!("?1006h"),
|
crossterm::csi!("?1006h"),
|
||||||
)
|
)
|
||||||
.as_bytes(),
|
.as_bytes(),
|
||||||
)?;
|
)?)
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create a new Ui struct, and execute the drawing loop
|
/// Create a new Ui struct, and execute the drawing loop
|
||||||
@@ -112,8 +111,7 @@ impl Ui {
|
|||||||
DisableMouseCapture
|
DisableMouseCapture
|
||||||
)?;
|
)?;
|
||||||
disable_raw_mode()?;
|
disable_raw_mode()?;
|
||||||
self.terminal.show_cursor()?;
|
Ok(self.terminal.show_cursor()?)
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Draw the the error message ui, for 5 seconds, with a countdown
|
/// Draw the the error message ui, for 5 seconds, with a countdown
|
||||||
|
|||||||
Reference in New Issue
Block a user