Small fixes

This commit is contained in:
daa84 2017-08-28 18:05:58 +03:00
parent e8161919a7
commit 6e0909ea95
2 changed files with 10 additions and 8 deletions

View File

@ -45,6 +45,7 @@ fn shape_dirty(ctx: &context::Context, ui_model: &mut ui_model::UiModel) {
for i in 0..line.line.len() { for i in 0..line.line.len() {
if line[i].dirty { if line[i].dirty {
// FIXME: dont shape/render empty items(space cells)
if let Some(mut item) = line.get_item_mut(i) { if let Some(mut item) = line.get_item_mut(i) {
let mut glyphs = pango::GlyphString::new(); let mut glyphs = pango::GlyphString::new();
{ {

View File

@ -1,4 +1,3 @@
use std;
use std::ops::{Index, IndexMut}; use std::ops::{Index, IndexMut};
use super::cell::Cell; use super::cell::Cell;
@ -176,7 +175,7 @@ impl StyledLine {
let mut byte_offset = 0; let mut byte_offset = 0;
for (cell_idx, cell) in line.line.iter().enumerate() { for (cell_idx, cell) in line.line.iter().enumerate() {
if cell.attrs.double_width || cell.ch.is_whitespace() { if cell.attrs.double_width {
continue; continue;
} }
@ -187,12 +186,14 @@ impl StyledLine {
cell_to_byte.push(cell_idx); cell_to_byte.push(cell_idx);
} }
insert_attrs( if !cell.ch.is_whitespace() {
cell, insert_attrs(
&attr_list, cell,
byte_offset as u32, &attr_list,
(byte_offset + len) as u32, byte_offset as u32,
); (byte_offset + len) as u32,
);
}
byte_offset += len; byte_offset += len;
} }