aboutsummaryrefslogtreecommitdiff
path: root/helix-tui/src/terminal.rs
diff options
context:
space:
mode:
Diffstat (limited to 'helix-tui/src/terminal.rs')
-rw-r--r--helix-tui/src/terminal.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/helix-tui/src/terminal.rs b/helix-tui/src/terminal.rs
index 22e9232f..802a8c1d 100644
--- a/helix-tui/src/terminal.rs
+++ b/helix-tui/src/terminal.rs
@@ -1,4 +1,5 @@
use crate::{backend::Backend, buffer::Buffer};
+use helix_view::editor::Config as EditorConfig;
use helix_view::graphics::{CursorKind, Rect};
use std::io;
@@ -16,6 +17,19 @@ pub struct Viewport {
resize_behavior: ResizeBehavior,
}
+#[derive(Debug)]
+pub struct Config {
+ pub enable_mouse_capture: bool,
+}
+
+impl From<EditorConfig> for Config {
+ fn from(config: EditorConfig) -> Self {
+ Self {
+ enable_mouse_capture: config.mouse,
+ }
+ }
+}
+
impl Viewport {
/// UNSTABLE
pub fn fixed(area: Rect) -> Viewport {
@@ -98,6 +112,14 @@ where
})
}
+ pub fn claim(&mut self, config: Config) -> io::Result<()> {
+ self.backend.claim(config)
+ }
+
+ pub fn restore(&mut self, config: Config) -> io::Result<()> {
+ self.backend.restore(config)
+ }
+
// /// Get a Frame object which provides a consistent view into the terminal state for rendering.
// pub fn get_frame(&mut self) -> Frame<B> {
// Frame {