Skip to content

Commit

Permalink
Read cursor position with cluttered input
Browse files Browse the repository at this point in the history
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...
  • Loading branch information
gwenn authored Jul 28, 2024
1 parent 6471b94 commit 825347f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/tty/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(());
}
Expand All @@ -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(());
}
Expand Down

0 comments on commit 825347f

Please sign in to comment.