TragicWarrior / libvterm

Based on libROTE, libvterm is a color terminal emulator. It mimics vt100, rxvt, xterm, and xterm 256 color mode
Other
38 stars 7 forks source link

Some keys doesn't work in xterm mode #85

Closed okbob closed 5 years ago

okbob commented 5 years ago

I try to 256 and higher colors. Inside vterm I switch to export TERM=xterm-256color. When I run pspg and I use some hicolor theme, then colors looks correct, but keyboard is messy - left, right, down, up keys doesn't work.

TragicWarrior commented 5 years ago

Pavel,

Can you tell me more about this? When are you issuing the bash export command? Before vshell is launched or afterward?

okbob commented 5 years ago

I export this value inside vshell. I tested to execute it before, but it had not any impact

TragicWarrior commented 5 years ago

Pavel,

Different terminals use different code sequences to describe cursor controls. The actual sequences are stored in the terminfo database. You can do something like "infocmp rxvt" to see the sequences for rxvt (as an example). When ncurses is initialized (via initscr or newterm) it reads the environment variable $TERM to determine which terminfo entry it should be looking at. If ncurses is started with $TERM set to "rxvt" and then you later change it to xterm-256color, the behavior would definitely be bad. This is especially true where ncurses apps are running inside of a ncurses app (like vshell).

The libvterm library addresses this problem by setting the terminal environment properly at the time it forks and starts the child process. For example, if you invoke vshell with the --xterm flag, it will automatically set $TERM to "xterm". If you invoke vshell with the --x256 flag, it will automatically set $TERM to "xterm-256color".

If you are not using the vshell demo program, but rather the library, then you can accomplish the same by passing in VTERM_FLAG_XTERM or VTERM_FLAG_XTERM_256 when you call vterm_init() or vterm_create().

That was the "long explanation". This short version is that if you start vshell without any flags it will be emulating rxvt and changing the $TERM var will cause bad behavior. Once I am comfortable with the quality of xterm emulation, I will be changing the default to xterm instead of rxvt.

okbob commented 5 years ago

po 25. 2. 2019 v 16:08 odesílatel TragicWarrior notifications@github.com napsal:

Pavel,

Different terminals use different code sequences to describe cursor controls. The actual sequences are stored in the terminfo database. You can do something like "infocmp rxvt" to see the sequences for rxvt (as an example). When ncurses is initialized (via initscr or newterm) it reads the environment variable $TERM to determine which terminfo entry it should be looking at. If ncurses is started with $TERM set to "rxvt" and then you later change it to xterm-256color, the behavior would definitely be bad. This is especially true where ncurses apps are running inside of a ncurses app (like vshell).

The libvterm library addresses this problem by setting the terminal environment properly at the time it forks and starts the child process. For example, if you invoke vshell with the --xterm flag, it will automatically set $TERM to "xterm". If you invoke vshell with the --x256 flag, it will automatically set $TERM to "xterm-256color".

If you are not using the vshell demo program, but rather the library, then you can accomplish the same by passing in VTERM_FLAG_XTERM or VTERM_FLAG_XTERM_256 when you call vterm_init() or vterm_create().

That was the "long explanation". This short version is that if you start vshell without any flags it will be emulating rxvt and changing the $TERM var will cause bad behavior. Once I am comfortable with the quality of xterm emulation, I will be changing the default to xterm instead of rxvt.

looks like my bad - when I started vshell with --xterm and x256, then all is ok.

You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/TragicWarrior/libvterm/issues/85#issuecomment-467046589, or mute the thread https://github.com/notifications/unsubscribe-auth/AAhXc65D_cLyKqx7JLnpOWjmHyOg8HBiks5vQ_x_gaJpZM4bKUQc .