Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'helix-tui/src/backend/mod.rs')
| -rw-r--r-- | helix-tui/src/backend/mod.rs | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/helix-tui/src/backend/mod.rs b/helix-tui/src/backend/mod.rs index 368a1b66..d8b0555c 100644 --- a/helix-tui/src/backend/mod.rs +++ b/helix-tui/src/backend/mod.rs @@ -6,14 +6,9 @@ use crate::{buffer::Cell, terminal::Config}; use helix_view::graphics::{CursorKind, Rect}; -#[cfg(all(feature = "termina", not(windows)))] -mod termina; -#[cfg(all(feature = "termina", not(windows)))] -pub use self::termina::TerminaBackend; - -#[cfg(all(feature = "termina", windows))] +#[cfg(feature = "crossterm")] mod crossterm; -#[cfg(all(feature = "termina", windows))] +#[cfg(feature = "crossterm")] pub use self::crossterm::CrosstermBackend; mod test; @@ -22,11 +17,13 @@ pub use self::test::TestBackend; /// Representation of a terminal backend. pub trait Backend { /// Claims the terminal for TUI use. - fn claim(&mut self) -> Result<(), io::Error>; + fn claim(&mut self, config: Config) -> Result<(), io::Error>; /// Update terminal configuration. fn reconfigure(&mut self, config: Config) -> Result<(), io::Error>; /// Restores the terminal to a normal state, undoes `claim` - fn restore(&mut self) -> Result<(), io::Error>; + fn restore(&mut self, config: Config) -> Result<(), io::Error>; + /// Forcibly resets the terminal, ignoring errors and configuration + fn force_restore() -> Result<(), io::Error>; /// Draws styled text to the terminal fn draw<'a, I>(&mut self, content: I) -> Result<(), io::Error> where @@ -35,6 +32,8 @@ pub trait Backend { fn hide_cursor(&mut self) -> Result<(), io::Error>; /// Sets the cursor to the given shape fn show_cursor(&mut self, kind: CursorKind) -> Result<(), io::Error>; + /// Gets the current position of the cursor + fn get_cursor(&mut self) -> Result<(u16, u16), io::Error>; /// Sets the cursor to the given position fn set_cursor(&mut self, x: u16, y: u16) -> Result<(), io::Error>; /// Clears the terminal @@ -43,6 +42,4 @@ pub trait Backend { fn size(&self) -> Result<Rect, io::Error>; /// Flushes the terminal buffer fn flush(&mut self) -> Result<(), io::Error>; - fn supports_true_color(&self) -> bool; - fn get_theme_mode(&self) -> Option<helix_view::theme::Mode>; } |