Spoke too soon... still bugs in cursor nav. This fixes one of them.
This commit is contained in:
parent
40bf2460a9
commit
bde11e6c7b
|
@ -67,17 +67,19 @@ impl<'a> LineFormatter for ConsoleLineFormatter {
|
||||||
fn index_to_v2d(&self, line: &Line, index: usize) -> (usize, usize) {
|
fn index_to_v2d(&self, line: &Line, index: usize) -> (usize, usize) {
|
||||||
let mut pos = (0, 0);
|
let mut pos = (0, 0);
|
||||||
let mut i = 0;
|
let mut i = 0;
|
||||||
|
let mut last_width = 0;
|
||||||
|
|
||||||
for (_, _pos, _) in self.vis_grapheme_iter(line) {
|
for (_, _pos, width) in self.vis_grapheme_iter(line) {
|
||||||
pos = _pos;
|
pos = _pos;
|
||||||
|
last_width = width;
|
||||||
i += 1;
|
i += 1;
|
||||||
|
|
||||||
if i > index {
|
if i > index {
|
||||||
break;
|
return pos;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return pos;
|
return (pos.0, pos.1 + last_width);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -408,7 +408,8 @@ impl TermUI {
|
||||||
grapheme_index += 1;
|
grapheme_index += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
screen_line += last_y as isize + 1;
|
let (dim_y, _) = editor.buffer.formatter.dimensions(line);
|
||||||
|
screen_line += dim_y as isize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user