(linetest) fix off by one error This has been here for a while: the "move to column" escape code is supposed to be zero-based, but empirically that does not seem to be the case on the several terminal emulators I've tested. (i.e. col(0) and col(1) are equivalent operations.) We can remove the erroneous padding from the relative position we compute, pass it to "move to row and column," and it does what you would expect.
1 files changed, 2 insertions(+), 2 deletions(-) M linetest/src/shell/ui/buffer.rs
M linetest/src/shell/ui/buffer.rs => linetest/src/shell/ui/buffer.rs +2 -2
@@ 350,12 350,12 @@ impl InputBuffer { // render the current viewport & update the cursor let beg = self.start; let end = cmp::min(self.buffer.len(), self.end); let relative_cursor_pos = (self.pos - self.start) + prompt.len() + 1; let relative_cursor_pos = (self.pos - self.start) + prompt.len(); assert!(relative_cursor_pos <= u16::MAX.into()); stdout .queue(Print(&self.buffer[beg..end]))? .queue(cursor::MoveToColumn(relative_cursor_pos as u16))?; .queue(cursor::MoveTo(relative_cursor_pos as u16, row))?; Ok(()) }