lfos / calcurse

A text-based calendar and scheduling application
https://calcurse.org
BSD 2-Clause "Simplified" License
988 stars 93 forks source link

a weird issue with colors happening #377

Open autoteelar opened 3 years ago

autoteelar commented 3 years ago

Version information. $ xq | grep calcurse calcurse-4.7.1_1: 2021-05-25 15:45 EDT - Latest git - literally just compiled and tested it right now just to see and yup same bug

Bug description. so i have custom terminal colors (using pywal) and basically, i open calcurse and things work great for the most part, but as soon as i spawn another window or resize the calcurse window in any way, colors break and reset back to the standard linux colors that linux comes with, the only solution i found so far is to close my entire terminal and open a new one.

Reproduce. spawn calcurse with image working fine here clearly,

image but BAM as soon as i spawn another window it looks like this, or even just resizing windows makes this happen, any modification at all to the calcurse windows makes this happen

Expected Behavior. im expected to resize and do whatever i want to the calcurse windows while keeping my system colors intact

Screenshots.

image here you can see after i close the calcurse window by pressing q, it has changed my whole system colorscheme

MorganSeltzer000 commented 3 years ago

Appears to be same issue as #368, please keep this to a single issue.

MorganSeltzer000 commented 3 years ago

(commenting here as #368 was closed) I looked at this a bit further out of curiousity, the issue appears to be with wal acting weirdly whenever endwin is called in the middle of a program on a terminal that is able to change the color value of a color, which is a reasonable action for an ncurses application to do. Try it yourself on your computer, just initscr(); start_color(); getch(); endwin(); refresh(); getch(); endwin();. Anyway, this issue should be closed as well, as this is not the fault of calcurse (I do not have permission to close the issue myself).

autoteelar commented 3 years ago

hmm well i wont close it because i want to know how to fix it, and its an unsolved issue, surely there must be some way to get around this

autoteelar commented 3 years ago

also this does not happen with any other ncurses based application ive ever used so far besides calcurse, including ranger, vim, nano, htop, and many others. It has to be a calcurse issue.

MorganSeltzer000 commented 3 years ago

Just because it does not occur on specific ncurses applications does not mean this is a calcurse issue. The reason (afaik) the other applications you mentioned do not change your setup is because they do not need to exit curses mode while running, but calcurse does in order to allow you to edit notes. endwin() is a standard ncurses method that is supposed to be called anytime that curses mode is exited (including in the middle of a program), and returns the terminal to its normal state, so calcurse should be able to call endwin() and be able to assume that everything is okay.

I can propose a workaround for you. wal does not store its color information in a way that is accessible to ncurses, so you'll have to call wal using whatever parameters you have it set to normally at inside utils.c in exit_calcurse() sometime after endwin() is called.

autoteelar commented 3 years ago

hmm i can try, thanks for the detailed explanation