From f4a70ba1ad173a02c9114e646250c97dfafba779 Mon Sep 17 00:00:00 2001 From: Nathan Vegdahl Date: Sun, 15 Feb 2015 20:35:17 -0800 Subject: [PATCH] Made screen drawing a tad faster for long lines. In preparation for much more major speed-ups with long lines. --- src/term_ui/mod.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/term_ui/mod.rs b/src/term_ui/mod.rs index 80b2855..3ff566e 100644 --- a/src/term_ui/mod.rs +++ b/src/term_ui/mod.rs @@ -382,7 +382,9 @@ impl TermUI { // Loop through the graphemes of the line and print them to // the screen. + let mut last_pos_y = 0; for (g, (pos_y, pos_x), width) in editor.formatter.iter(line) { + last_pos_y = pos_y; // Calculate the cell coordinates at which to draw the grapheme let px = pos_x as isize + screen_col - editor.view_pos.1 as isize; let py = pos_y as isize + screen_line; @@ -433,8 +435,7 @@ impl TermUI { grapheme_index += 1; } - let (dim_y, _) = editor.formatter.dimensions(line); - screen_line += dim_y as isize; + screen_line += last_pos_y as isize + 1; line_num += 1; }