Skip to content

Commit b08aba8

Browse files
committed
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.
1 parent 83abbe5 commit b08aba8

File tree

4 files changed

+0
-29
lines changed

4 files changed

+0
-29
lines changed

helix-tui/src/backend/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ pub trait Backend {
3030
fn hide_cursor(&mut self) -> Result<(), io::Error>;
3131
/// Sets the cursor to the given shape
3232
fn show_cursor(&mut self, kind: CursorKind) -> Result<(), io::Error>;
33-
/// Gets the current position of the cursor
34-
fn get_cursor(&mut self) -> Result<(u16, u16), io::Error>;
3533
/// Sets the cursor to the given position
3634
fn set_cursor(&mut self, x: u16, y: u16) -> Result<(), io::Error>;
3735
/// Clears the terminal

helix-tui/src/backend/termina.rs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -514,25 +514,6 @@ impl Backend for TerminaBackend {
514514
self.flush()
515515
}
516516

517-
fn get_cursor(&mut self) -> Result<(u16, u16), io::Error> {
518-
write!(
519-
self.terminal,
520-
"{}",
521-
csi::Csi::Cursor(csi::Cursor::RequestActivePositionReport),
522-
)?;
523-
self.terminal.flush()?;
524-
let event = self.terminal.read(|event| {
525-
matches!(
526-
event,
527-
Event::Csi(Csi::Cursor(csi::Cursor::ActivePositionReport { .. }))
528-
)
529-
})?;
530-
let Event::Csi(Csi::Cursor(csi::Cursor::ActivePositionReport { line, col })) = event else {
531-
unreachable!();
532-
};
533-
Ok((line.get_zero_based(), col.get_zero_based()))
534-
}
535-
536517
fn set_cursor(&mut self, x: u16, y: u16) -> io::Result<()> {
537518
let col = OneBased::from_zero_based(x);
538519
let line = OneBased::from_zero_based(y);

helix-tui/src/backend/test.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,6 @@ impl Backend for TestBackend {
139139
Ok(())
140140
}
141141

142-
fn get_cursor(&mut self) -> Result<(u16, u16), io::Error> {
143-
Ok(self.pos)
144-
}
145-
146142
fn set_cursor(&mut self, x: u16, y: u16) -> Result<(), io::Error> {
147143
self.pos = (x, y);
148144
Ok(())

helix-tui/src/terminal.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,10 +220,6 @@ where
220220
Ok(())
221221
}
222222

223-
pub fn get_cursor(&mut self) -> io::Result<(u16, u16)> {
224-
self.backend.get_cursor()
225-
}
226-
227223
pub fn set_cursor(&mut self, x: u16, y: u16) -> io::Result<()> {
228224
self.backend.set_cursor(x, y)
229225
}

0 commit comments

Comments
 (0)