aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/main.rs b/src/main.rs
index 7c672e4..2b6a814 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -133,16 +133,18 @@ impl State {
let line = self.line();
write!(stdout(), "\x1b[{}H\x1b[K", self.cursor_row + 1)?;
line.slice(0, self.line_offset).print(&mut stdout())?;
- if self.line_offset == line.len() {
- write!(stdout(), "\x1b[C\x1b[D\x1b[K")?;
- return Ok(());
- }
let (_, col) = term::cursor_pos(stdin)?;
if col == size.ws_col - 1 {
self.cursor_col = col - 1;
write!(stdout(), "\x1b[D\x1b[K")?;
return Ok(());
}
+ if self.line_offset == line.len() {
+ if col > self.cursor_col {
+ self.cursor_col = col;
+ }
+ return Ok(());
+ }
self.cursor_col = col;
line.slice(self.line_offset, line.len())
.print(&mut stdout())?;