"Word wrapping is easy.
-
"Word wrapping is easy. Just count characters and split on spaces, right?"
Sure.
Until you account for Unicode grapheme clusters, terminal cell width, combining characters, ZWJ, emoji, CJK, tabs, ANSI sequences, OSC 8 hyperlinks, indentation, hard/soft breaks, unbreakable words, hyphenation, and trailing whitespace.
And then a scrollbar enters the chat.
Easy.
-
"Word wrapping is easy. Just count characters and split on spaces, right?"
Sure.
Until you account for Unicode grapheme clusters, terminal cell width, combining characters, ZWJ, emoji, CJK, tabs, ANSI sequences, OSC 8 hyperlinks, indentation, hard/soft breaks, unbreakable words, hyphenation, and trailing whitespace.
And then a scrollbar enters the chat.
Easy.
@fribbledom And don’t forget Taumatawhakatangihangakoauauotamateaturipukakapikimaungahoronukupokaiwhenuakitanatahu
-
"Word wrapping is easy. Just count characters and split on spaces, right?"
Sure.
Until you account for Unicode grapheme clusters, terminal cell width, combining characters, ZWJ, emoji, CJK, tabs, ANSI sequences, OSC 8 hyperlinks, indentation, hard/soft breaks, unbreakable words, hyphenation, and trailing whitespace.
And then a scrollbar enters the chat.
Easy.
@fribbledom you forgot ... wrapping around images.
-
"Word wrapping is easy. Just count characters and split on spaces, right?"
Sure.
Until you account for Unicode grapheme clusters, terminal cell width, combining characters, ZWJ, emoji, CJK, tabs, ANSI sequences, OSC 8 hyperlinks, indentation, hard/soft breaks, unbreakable words, hyphenation, and trailing whitespace.
And then a scrollbar enters the chat.
Easy.
@fribbledom I've been struggling with understanding all of this because I want to make a modern terminal emulator and display controller on a microcontroller, then FPGA, for use in Open Hardware designs. It's so much.
-
@fribbledom I've been struggling with understanding all of this because I want to make a modern terminal emulator and display controller on a microcontroller, then FPGA, for use in Open Hardware designs. It's so much.
Don't worry, you're discovering the secret of terminal emulation: nobody actually understands any of it

It's legacy hacks built on legacy hacks built on a workaround for a historical accident, with another workaround added because the first workaround became a de facto standard.
You're probably doing great. Welcome to terminal development!
-
"Word wrapping is easy. Just count characters and split on spaces, right?"
Sure.
Until you account for Unicode grapheme clusters, terminal cell width, combining characters, ZWJ, emoji, CJK, tabs, ANSI sequences, OSC 8 hyperlinks, indentation, hard/soft breaks, unbreakable words, hyphenation, and trailing whitespace.
And then a scrollbar enters the chat.
Easy.
@fribbledom wrap the words in a burrito and eat it
-
J jwcph@helvede.net shared this topic