slang-users mailing list

[2016 Date Index] [2016 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

[slang-users] Re: Treat screen* and tmux* as almost_vtxxx

On Sun, May 1, 2016 at 1:25 AM, Yuri Khan <yuri.v.khan@xxxxxxxxx> wrote:

> * Now resize the terminal emulator window or split the tmux window into
>   panes. (The problem is triggered by any change of the number of lines
>   or columns in the pane in which mc is running.)
> Expected behavior: the output of `ls -al` remains on screen.
> Observed behavior: the output disappears.

John E. Davis contacted me off-list and suggested that the real cause
of the problem is elsewhere and S-Lang’s keypad initialization or lack
thereof only masks/uncovers it. So I investigated further.

Midnight Commander used to use ncurses as its screen library.
Afterwards, it was ported to S-Lang, but retained ncurses as a build
option. Thus, it has to maintain compatibility with both libraries,
which is not straightforward.

One of the differences lies in reacting to the window size change
signal (WINCH). Midnight Commander’s signal handler sets a global flag
which is then handled in several places in code. With ncurses, the
same code works for all such places, whether panels are displayed
(alternate screen) or hidden (normal screen). With S-Lang, no such

The code that runs in case of S-Lang calls the SLsmg_reinit_smg
function, which, if called with normal screen active, causes a switch
to the alternate screen. The initial state of the alternate screen is
blank. After that switch, the SLtt_init_keypad function is called,
which, depending on the almost_vtxxx flag, either flushes the output
buffer or does not, and this explains why the bug is only visible in
the 256-color configuration.

I filed [a ticket][1] against Midnight Commander and proposed a patch,
and am working with mc’s maintainers to get it accepted.


_Ceterum censeo_ it still would be the right thing for S-Lang to treat
"screen" and all its derivatives ("screen-256color", "screen-bce",
"screen.xterm", …) and "tmux" and its derivatives consistently —
meaning forced keypad initialization in all or none of them.
For list information, visit <>.

[2016 date index] [2016 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]