Fixed bug in buffer drawing code.
It was causing the entire last line to be re-scanned to find the cursor drawing position if the cursor was at the end of the buffer. This was both slow and resulted in an incorrect position, since all the rest of the drawing assumes line blocks.
This commit is contained in:
parent
ae26c5f873
commit
c348f252bb
|
@ -479,8 +479,7 @@ impl TermUI {
|
||||||
|
|
||||||
if at_cursor {
|
if at_cursor {
|
||||||
// Calculate the cell coordinates at which to draw the cursor
|
// Calculate the cell coordinates at which to draw the cursor
|
||||||
let line = self.editor.buffer.get_line(self.editor.buffer.line_count()-1);
|
let pos_x = editor.formatter.index_to_horizontal_v2d(&self.editor.buffer, self.editor.buffer.grapheme_count());
|
||||||
let (_, pos_x) = editor.formatter.index_to_v2d(line.grapheme_iter(), line.grapheme_count());
|
|
||||||
let px = pos_x as isize + screen_col - editor.view_pos.1 as isize;
|
let px = pos_x as isize + screen_col - editor.view_pos.1 as isize;
|
||||||
let py = screen_line - 1;
|
let py = screen_line - 1;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user