Skip to content

Commit

Permalink
Merge pull request #269 from finistseb/master
Browse files Browse the repository at this point in the history
[#268] Fix Input tail length calculation (wrong cursor positioning)
  • Loading branch information
pksunkara committed Jul 13, 2023
2 parents 024eaea + b8d94fd commit dfd6e22
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/prompts/input.rs
Expand Up @@ -343,7 +343,7 @@ where
if !tail.is_empty() {
term.write_str(&tail)?;

let total = position + prompt_len + tail.len();
let total = position + prompt_len + tail.chars().count();
let total_line = total / line_size;
let line_cursor = (position + prompt_len) / line_size;
term.move_cursor_up(total_line - line_cursor)?;
Expand All @@ -360,7 +360,7 @@ where
let tail: String =
iter::once(&chr).chain(chars[position..].iter()).collect();
term.write_str(&tail)?;
term.move_cursor_left(tail.len() - 1)?;
term.move_cursor_left(tail.chars().count() - 1)?;
term.flush()?;
}
Key::ArrowLeft if position > 0 => {
Expand Down

0 comments on commit dfd6e22

Please sign in to comment.