Unnamed repository; edit this file 'description' to name the repository.
Remove `Backend::get_cursor`
It is unused and cannot be used on some terminal hosts like `conhost` that do not respond to VT queries. This doesn't have any affect on behavior - I'm removing it so that we don't rely on it in the future.
Michael Davis 6 months ago
parent 83abbe5 · commit b08aba8
-rw-r--r--helix-tui/src/backend/mod.rs2
-rw-r--r--helix-tui/src/backend/termina.rs19
-rw-r--r--helix-tui/src/backend/test.rs4
-rw-r--r--helix-tui/src/terminal.rs4
4 files changed, 0 insertions, 29 deletions
diff --git a/helix-tui/src/backend/mod.rs b/helix-tui/src/backend/mod.rs
index 33596a66..3f0ec355 100644
--- a/helix-tui/src/backend/mod.rs
+++ b/helix-tui/src/backend/mod.rs
@@ -30,8 +30,6 @@ 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
diff --git a/helix-tui/src/backend/termina.rs b/helix-tui/src/backend/termina.rs
index c818d901..8c6844d9 100644
--- a/helix-tui/src/backend/termina.rs
+++ b/helix-tui/src/backend/termina.rs
@@ -514,25 +514,6 @@ impl Backend for TerminaBackend {
self.flush()
}
- fn get_cursor(&mut self) -> Result<(u16, u16), io::Error> {
- write!(
- self.terminal,
- "{}",
- csi::Csi::Cursor(csi::Cursor::RequestActivePositionReport),
- )?;
- self.terminal.flush()?;
- let event = self.terminal.read(|event| {
- matches!(
- event,
- Event::Csi(Csi::Cursor(csi::Cursor::ActivePositionReport { .. }))
- )
- })?;
- let Event::Csi(Csi::Cursor(csi::Cursor::ActivePositionReport { line, col })) = event else {
- unreachable!();
- };
- Ok((line.get_zero_based(), col.get_zero_based()))
- }
-
fn set_cursor(&mut self, x: u16, y: u16) -> io::Result<()> {
let col = OneBased::from_zero_based(x);
let line = OneBased::from_zero_based(y);
diff --git a/helix-tui/src/backend/test.rs b/helix-tui/src/backend/test.rs
index 47049cd8..37b5ff5c 100644
--- a/helix-tui/src/backend/test.rs
+++ b/helix-tui/src/backend/test.rs
@@ -139,10 +139,6 @@ impl Backend for TestBackend {
Ok(())
}
- fn get_cursor(&mut self) -> Result<(u16, u16), io::Error> {
- Ok(self.pos)
- }
-
fn set_cursor(&mut self, x: u16, y: u16) -> Result<(), io::Error> {
self.pos = (x, y);
Ok(())
diff --git a/helix-tui/src/terminal.rs b/helix-tui/src/terminal.rs
index 9dcad81d..0b038fdf 100644
--- a/helix-tui/src/terminal.rs
+++ b/helix-tui/src/terminal.rs
@@ -220,10 +220,6 @@ where
Ok(())
}
- pub fn get_cursor(&mut self) -> io::Result<(u16, u16)> {
- self.backend.get_cursor()
- }
-
pub fn set_cursor(&mut self, x: u16, y: u16) -> io::Result<()> {
self.backend.set_cursor(x, y)
}