The display weirdness (e.g. the Z shell's percent character showing up) that you are seeing in your demo is because you are putting the terminal line discipline into raw mode, raw mode of course does not do CR-before-LF stuffing, and there's some confusion in the code as to when it does and when it does not explicitly emit CRs.
* https://github.com/bmf-san/ggc/blob/9e93ef8a87973cab916e37a9...
* https://github.com/bmf-san/ggc/blob/9e93ef8a87973cab916e37a9...