Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clear (\033[m) is put after each call to tb_change_cell #30

Closed
robem opened this issue Jan 29, 2014 · 0 comments
Closed

clear (\033[m) is put after each call to tb_change_cell #30

robem opened this issue Jan 29, 2014 · 0 comments

Comments

@robem
Copy link
Contributor

robem commented Jan 29, 2014

try the following code snippet in normal color mode:

for (color = 1; color < 8; color++) {
    tb_change_cell(color, 2, 'X', 2, color);
}
tb_present();

The forground color changes after the first tb_change_cell() to white.

Only the bg (color) parameter changes that's why the code calls write_sgr_bg() but somehow a clear was introduced earlier so that the foreground value is negated/overwritten by the default one.

I tested it against e742ddb5908dff205dde338b50f3a92ec2e844e1 and it worked.
So my commits introduced a bug.
I will look into it tomorrow evening.

@nsf nsf closed this as completed in ed4dfdf Jan 29, 2014
nullgemm pushed a commit to nullgemm/termbox_next that referenced this issue Aug 26, 2018
The bug was caused by a wrong assumption that individual write_sgr functions
are there for optimization purposes. They are not. Their purpose is to make
TB_DEFAULT work. Therefore TB_DEFAULT != lastfg/lastbg. In fact the send_attr
puts SGR0 as soon as it detects deviation from lastfg or lastbg, which means
the actual attributes are equal to terminal defaults from that point.

The fix restores the previous logic for NORMAL mode and forces a complete
update for other output modes. Again, complete doesn't mean less optimized, it
was complete in most of the cases before as well. The update happens partially
only if the TB_DEFAULT is involved.

cherry-pick ed4dfdf
nullgemm pushed a commit to nullgemm/termbox_next that referenced this issue Jul 27, 2020
The bug was caused by a wrong assumption that individual write_sgr functions
are there for optimization purposes. They are not. Their purpose is to make
TB_DEFAULT work. Therefore TB_DEFAULT != lastfg/lastbg. In fact the send_attr
puts SGR0 as soon as it detects deviation from lastfg or lastbg, which means
the actual attributes are equal to terminal defaults from that point.

The fix restores the previous logic for NORMAL mode and forces a complete
update for other output modes. Again, complete doesn't mean less optimized, it
was complete in most of the cases before as well. The update happens partially
only if the TB_DEFAULT is involved.

cherry-pick ed4dfdf
nullgemm pushed a commit to nullgemm/termbox_next that referenced this issue Jul 27, 2020
The bug was caused by a wrong assumption that individual write_sgr functions
are there for optimization purposes. They are not. Their purpose is to make
TB_DEFAULT work. Therefore TB_DEFAULT != lastfg/lastbg. In fact the send_attr
puts SGR0 as soon as it detects deviation from lastfg or lastbg, which means
the actual attributes are equal to terminal defaults from that point.

The fix restores the previous logic for NORMAL mode and forces a complete
update for other output modes. Again, complete doesn't mean less optimized, it
was complete in most of the cases before as well. The update happens partially
only if the TB_DEFAULT is involved.

cherry-pick ed4dfdf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant