Support double_width chars

This commit is contained in:
daa84
2017-09-13 12:39:02 +03:00
parent 31a0fea819
commit dc8d6d5a70
5 changed files with 132 additions and 63 deletions

View File

@@ -108,6 +108,24 @@ impl ModelRect {
if right < self.right + len_since_right {
right = self.right + len_since_right;
}
// extend also double_width chars
let cell = &line.line[self.left];
if self.left > 0 && cell.attrs.double_width {
let dw_char_idx = self.left - 1;
if dw_char_idx < left {
left = dw_char_idx;
}
}
let dw_char_idx = self.right + 1;
if let Some(cell) = line.line.get(dw_char_idx) {
if cell.attrs.double_width {
if right < dw_char_idx {
right = dw_char_idx;
}
}
}
}
self.left = left;