aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs
index 0dfe335..c5ea852 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -75,7 +75,7 @@ fn floor_grapheme_cluster(
line: &Rope,
offset: usize,
) -> Result<usize, Box<dyn Error>> {
- if offset == 0 || offset == line.len() {
+ if offset == 0 || offset == line.len() || line.byte(offset) < 128 {
return Ok(offset);
}
let mut offset = line.floor_char_boundary(offset);
@@ -101,6 +101,9 @@ fn ceil_grapheme_cluster(
offset: usize,
) -> Result<usize, Box<dyn Error>> {
let mut offset = line.ceil_char_boundary(offset);
+ if offset == line.len() || line.byte(offset) < 128 {
+ return Ok(offset);
+ }
write!(stdout(), "\x1b[G")?;
line.slice(0, offset).print(&mut stdout())?;
let (_, target_col) = term::cursor_pos(stdin)?;