mirror of https://github.com/helix-editor/helix
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.termina
parent
6359e1ac03
commit
a34064019a
|
@ -21,7 +21,6 @@ pub trait Backend {
|
||||||
I: Iterator<Item = (u16, u16, &'a Cell)>;
|
I: Iterator<Item = (u16, u16, &'a Cell)>;
|
||||||
fn hide_cursor(&mut self) -> Result<(), io::Error>;
|
fn hide_cursor(&mut self) -> Result<(), io::Error>;
|
||||||
fn show_cursor(&mut self, kind: CursorKind) -> Result<(), io::Error>;
|
fn show_cursor(&mut self, kind: CursorKind) -> Result<(), io::Error>;
|
||||||
fn get_cursor(&mut self) -> Result<(u16, u16), io::Error>;
|
|
||||||
fn set_cursor(&mut self, x: u16, y: u16) -> Result<(), io::Error>;
|
fn set_cursor(&mut self, x: u16, y: u16) -> Result<(), io::Error>;
|
||||||
fn clear(&mut self) -> Result<(), io::Error>;
|
fn clear(&mut self) -> Result<(), io::Error>;
|
||||||
fn size(&self) -> Result<Rect, io::Error>;
|
fn size(&self) -> Result<Rect, io::Error>;
|
||||||
|
|
|
@ -511,25 +511,6 @@ impl Backend for TerminaBackend {
|
||||||
self.flush()
|
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<()> {
|
fn set_cursor(&mut self, x: u16, y: u16) -> io::Result<()> {
|
||||||
let col = OneBased::from_zero_based(x);
|
let col = OneBased::from_zero_based(x);
|
||||||
let line = OneBased::from_zero_based(y);
|
let line = OneBased::from_zero_based(y);
|
||||||
|
|
|
@ -139,10 +139,6 @@ impl Backend for TestBackend {
|
||||||
Ok(())
|
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> {
|
fn set_cursor(&mut self, x: u16, y: u16) -> Result<(), io::Error> {
|
||||||
self.pos = (x, y);
|
self.pos = (x, y);
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
@ -216,10 +216,6 @@ where
|
||||||
Ok(())
|
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<()> {
|
pub fn set_cursor(&mut self, x: u16, y: u16) -> io::Result<()> {
|
||||||
self.backend.set_cursor(x, y)
|
self.backend.set_cursor(x, y)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue