gansm / finalcut

A text-based widget toolkit
https://github.com/gansm/finalcut/wiki/First-steps#first-steps-with-the-final-cut-widget-toolkit
GNU Lesser General Public License v3.0
981 stars 52 forks source link

Update to reset the ColorPalette in ST terminal Bug #115 #116

Closed wimstockman closed 1 year ago

wimstockman commented 1 year ago

Hi Markus, This is a solution for the problem I had with the ST terminal not resetting on exit. Kind Regards Wim

gansm commented 1 year ago

Hi Wim, it seems that we both approached at the same time on the same problem (b291d04). Initially, I had considered resetting all terminal settings, similar to Mintty. After learning that the st terminal can reset individual colors, I gave up on the reset solution.

wimstockman commented 1 year ago

Hi , I patched my version of ST terminal. Seems there was only one line of code missing :-). And sent my patch to the suckless group. maybe the will implement it. I keep you posted. See ya

gansm commented 1 year ago

Hi Wim, the bad thing is that this capability is stored in the terminfo descriptions for "st-256color".

$ infocmp -1 st-256color | grep "oc=" | sed -e 's/,$//'
    oc=\E]104\007,

So the following should have worked:

$ for c in $(seq 1 7); do echo -ne "\033]4;${c};rgb:30/30/30\a\033[$((40 + c))m  "; done; echo -e "\n\033[mBe colorful"; tput oc

st - terminal grafik

xterm grafik


I also saw that the keys <Home>, <End>, <Pg Up>, and <Pg Dn> send identical escape sequences as <A1> (Upper left of keypad), <C1> (Lower left of keypad), <A3> (Upper right of keypad), and <C3> (Lower right of keypad). That's awful because the keypad keys are in front of the other keys in the list. Therefore, these keys are wrongly detected. You can see this well with the program 'examples/keyboard'.

The keypad arrangement:

 ┌───────┬───────┬───────┐
 │  A1   │  up   │  A3   │
 ├───────┼───────┼───────┤
 │ left  │  B2   │ right │
 ├───────┼───────┼───────┤
 │  C1   │ down  │  C3   │
 └───────┴───────┴───────┘

I am looking for a suitable solution here.

wimstockman commented 1 year ago

Hi Markus, tested your keyboard example with : xterm, urxvt, termite , st. There is only one and that is urxvt whom makes a difference between the Upper-left,Upper-right,Lower-right,Lower-left,Home,End,PgUp,PgDn xterm and termite , just make it Home,End, PgUp, Pg Dn. st makes it Upper-left,Upper-right,Lower-right,left but no home end pgdown or pgup. weird :-)

Don't think so many people use ST. So you don't have to spent the weekend over it. Kind regards, Wim

gansm commented 1 year ago

I could fix the problem (5cb3ac3)