LoopPerfect / rxterm

Functional reactive terminals in C++ ⚡⌨️
MIT License
265 stars 26 forks source link

Issue with style generation. #21

Open rolesen opened 3 years ago

rolesen commented 3 years ago

Hey, cool library for doing vt100 with a small footprint. Theres an issue with text style generation i encountered once stuff starts to get a bit more complicated than just a hello world.

Basicly, the main issue, I think, is with the toString() (or maybe with diff algos). I had bgMod or fgMod ending up with a "0" then it will reset basicly everything before that - even the background color just applied. defaultMod() can also write "0" but is less of an issue i guess.

A workaround seems to be: just specify both colors on all styles you use, then you don't run into it !

I tried to fix it naively, but found out the steps that have been taken to not reapply the same styles, etc. when writing out, and this complicates the matter.

The member function on "Style" we are talking about:


  std::string toString() const {
    return computeMod(
        defaultMod(),
        boldMod(),
        underlineMod(),
        faintMod(),
        italicMod(),
        hiddenMod(),
        crossedMod(),
        bgMod(),
        fgMod()
    );
nikhedonia commented 3 years ago

Do you have some concrete examples how things fail? I suspect that the diffing algorithm needs some attention.