Hacker News new | past | comments | ask | show | jobs | submit login

I see that Pixel represents each character on the screen as a "char". This does not seem a simplification made when writing the blog post, as the Rxterm library does the same [1]. Doesn't this limit too much the applicability of the code? There are plenty of interesting Unicode characters to use in a terminal interface (e.g., non-English alphabets, box drawing characters) that cannot be represented using a char.

I imagine that the choice was due to simplicity, as just changing "char" to "char32_t" does not completely solve the situation because of Unicode's combination characters. What one would need here is a "Pixel" structure capable to hold any Unicode grapheme, which unfortunately can be an arbitrary long sequence of bytes in any UTF8/16/32 encoding.

I am writing this because a few months ago I was trying to create some library similar to RxTerm and build a structure very similar to RxTerm's "Pixel", but got struck in inventing a smart way to keep a matrix of graphemes representing the state of the terminal screen. I gave up because the only idea I had was to use "std::string" within Pixel, and this didn't satisfy my taste.

Also, it seems that RxTerm does not use a terminfo database, but it just hardcodes ANSI escape sequences [2]. I understand that the concept of a terminfo database was invented when the number of incompatible terminals out there was far larger than today. How much widespread are today the escape sequences (cursor movements, color, font styles, etc.) used by libraries like RxTerm?

[1] https://github.com/LoopPerfect/rxterm/blob/master/rxterm/inc...

[2] https://github.com/LoopPerfect/rxterm/blob/master/rxterm/inc...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: