cursive icon indicating copy to clipboard operation
cursive copied to clipboard

[BUG] Colors aren't returned to how they looked before in a tty

Open Builditluc opened this issue 3 years ago • 1 comments

Describe the bug When quitting a program in a tty, the colors (foreground and background) don't reset and the terminal looks weird. It only happens in a tty

To Reproduce (for my application)

  1. Compile and run wiki-tui (should also happen with any other cursive program) in a tty
  2. Quit the program
  3. Look at your terminal

Expected behavior The colors get reset and the terminal looks like before.

Screenshots Screenshot from the original bug report:

screenshot

Environment

  • Operating system used: Arch Linux (new/minimal install to test the AUR package)
  • Backend used: crossterm
  • Cursive version (from crates.io, from git, ...): crates.io (v0.17)

Additional context The original bug report in the wiki-tui repo can be found here: https://github.com/Builditluc/wiki-tui/issues/74

I think this bug has to do with cursive because the whole color resetting thing gets handled by cursive itself.

EDIT: The readme states that custom colors are not supported in tty mode. Does this have something to do with the colors not resetting properly? If yes, how can I detect if we are in a tty so the program doesn't use custom colors?

Builditluc avatar Aug 09 '22 11:08 Builditluc

Hi, and thanks for the report!

I suppose the native console does not support alternative screen? In any case I added a commit to explicitly reset the colors when leaving the application; does this fix the issue for you?

gyscos avatar Sep 15 '22 18:09 gyscos

The issues seems to be fixed on local testing. Fix was released as part of cursive-core 0.3.6.

I'll close the issue for now, feel free to re-open if needed.

gyscos avatar Nov 29 '22 18:11 gyscos