From 6e0909ea95d68c97f1bd5eb3a7dc08a22ead37b0 Mon Sep 17 00:00:00 2001 From: daa84 Date: Mon, 28 Aug 2017 18:05:58 +0300 Subject: [PATCH] Small fixes --- src/render/mod.rs | 1 + src/ui_model/line.rs | 17 +++++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/render/mod.rs b/src/render/mod.rs index d77f800..819d508 100644 --- a/src/render/mod.rs +++ b/src/render/mod.rs @@ -45,6 +45,7 @@ fn shape_dirty(ctx: &context::Context, ui_model: &mut ui_model::UiModel) { for i in 0..line.line.len() { if line[i].dirty { + // FIXME: dont shape/render empty items(space cells) if let Some(mut item) = line.get_item_mut(i) { let mut glyphs = pango::GlyphString::new(); { diff --git a/src/ui_model/line.rs b/src/ui_model/line.rs index 26202c9..6bdb456 100644 --- a/src/ui_model/line.rs +++ b/src/ui_model/line.rs @@ -1,4 +1,3 @@ -use std; use std::ops::{Index, IndexMut}; use super::cell::Cell; @@ -176,7 +175,7 @@ impl StyledLine { let mut byte_offset = 0; for (cell_idx, cell) in line.line.iter().enumerate() { - if cell.attrs.double_width || cell.ch.is_whitespace() { + if cell.attrs.double_width { continue; } @@ -187,12 +186,14 @@ impl StyledLine { cell_to_byte.push(cell_idx); } - insert_attrs( - cell, - &attr_list, - byte_offset as u32, - (byte_offset + len) as u32, - ); + if !cell.ch.is_whitespace() { + insert_attrs( + cell, + &attr_list, + byte_offset as u32, + (byte_offset + len) as u32, + ); + } byte_offset += len; }