@@ 203,6 203,7 @@ fn drawline(state: *state) (void | vt::error) = {
const iter = strings::iter(line);
+ let ansi_seq: []u8 = [];
let col = 0z;
for (col < state.cols - 1) {
const rn = match (strings::next(&iter)) {
@@ 212,6 213,19 @@ fn drawline(state: *state) (void | vt::error) = {
break;
};
+ if (rn == '\x1b') {
+ append(ansi_seq, rn: u8);
+ continue;
+ };
+ if (len(ansi_seq) > 0) {
+ append(ansi_seq, rn: u8);
+ if (rn == 'm') {
+ io::write(state.term, ansi_seq)?;
+ delete(ansi_seq[..]);
+ };
+ continue;
+ };
+
if (!state.conf.nonprint &&
ascii::valid(rn) && !ascii::isprint(rn) && rn != '\t') {
continue;
@@ 220,7 234,6 @@ fn drawline(state: *state) (void | vt::error) = {
vt::print(state.term, rn)?;
// TODO: measure dimensions properly
- // - skip escape codes in input?
// - measure unicode sequences
if (rn == '\t') {
col += 8;