diff --git a/include/printer.cpp b/include/printer.cpp index 31dd45e1b..828b10e0e 100755 --- a/include/printer.cpp +++ b/include/printer.cpp @@ -436,9 +436,12 @@ const char* TPrintrow::row_codified() const // returns the row with @-codes for font style and color char last_attr = -1; int last_color = -1; - int last = 0, k = 0; + int last = 0, k = 0, len = -1; for (int i = 0; i < _row.size(); i++) + if (_row[i] > ' ') len = i; + + for (i = 0; i < _row.size(); i++) { if (_attr[i] != last_attr) { @@ -460,7 +463,7 @@ const char* TPrintrow::row_codified() const } last_attr = _attr[i]; } - if (_cols[i] != last_color && _row[i] > ' ') + if (_cols[i] != last_color && i <= len) { __tmp_string[k++] = '$'; __tmp_string[k++] = '[';