Skip to content

Commit e2d07c0

Browse files
committed
Text.h: Rewriting print_complex_chunks() so it outputs a single complex string. This seems to eliminate chaotic garbage output on linux systems.
1 parent 6e43802 commit e2d07c0

File tree

1 file changed

+8
-2
lines changed
  • include/Termin8or/screen

1 file changed

+8
-2
lines changed

include/Termin8or/screen/Text.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,11 +179,17 @@ namespace t8
179179

180180
void print_complex_chunks(const std::vector<ComplexStringChunk>& chunk_vec)
181181
{
182+
std::string output;
182183
for (const auto& chunk : chunk_vec)
183184
{
184-
gotorc(chunk.pos.r, chunk.pos.c);
185-
print_complex_sequential(chunk.text);
185+
output += get_gotorc_str(chunk.pos.r, chunk.pos.c);
186+
for (const auto& [ch, fg, bg] : chunk.text)
187+
output += get_color_string(fg, bg) + ch;
186188
}
189+
190+
// Reset color.
191+
output += "\033[0m";
192+
std::cout << output;
187193
}
188194

189195
void print_reset() const

0 commit comments

Comments
 (0)