From 825347fe871861d12714d9725c28ef698e84d6c4 Mon Sep 17 00:00:00 2001 From: gwenn <45554+gwenn@users.noreply.github.com> Date: Sun, 28 Jul 2024 09:23:41 +0200 Subject: [PATCH] Read cursor position with cluttered input Try to read cursor position even when stdin contains / receives user input. Currently, we fail so that we don't discard any user input. But we should be able to fill the `BufReader` instead... --- src/tty/unix.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tty/unix.rs b/src/tty/unix.rs index 071e4ba02..66e834d71 100644 --- a/src/tty/unix.rs +++ b/src/tty/unix.rs @@ -1119,7 +1119,7 @@ impl Renderer for PosixRenderer { } fn move_cursor_at_leftmost(&mut self, rdr: &mut PosixRawReader) -> Result<()> { - if rdr.poll(PollTimeout::ZERO)? != 0 { + if rdr.poll(PollTimeout::ZERO)? != 0 { // TODO fill input buffer instead debug!(target: "rustyline", "cannot request cursor location"); return Ok(()); } @@ -1130,7 +1130,7 @@ impl Renderer for PosixRenderer { || rdr.next_char()? != '\x1b' || rdr.next_char()? != '[' || read_digits_until(rdr, ';')?.is_none() - { + { // TODO fill input buffer instead warn!(target: "rustyline", "cannot read initial cursor location"); return Ok(()); }