Ticket #3659 (closed defect: duplicate)

Opened 3 years ago

Last modified 3 years ago

Subshell clears the terminal before showing prompt

Reported by: woodsb02 Owned by:
Priority: major Milestone:
Component: mc-core Version: master
Keywords: Cc:
Blocked By: Blocking:
Branch state: no branch Votes for changeset:

Description

With the release of mc 4.8.17, the subshell is clearing the terminal before showing the prompt.

How to repeat this bug:

  1. On FreeBSD, run mc outside of a tmux session
  2. Run 'ls' on the prompt at the bottom of the mc screen
  3. Push Ctrl+o to show the subshell and attempt to reveal the output of ls
  4. The terminal is blank, but at the prompt allowing further commands to run normally.

When mc is compiled with --with-screen=slang, this occurs in an xterm in X11 as well as on the console (note that the environmental variable TERM=xterm in both the xterm and on the console). It does not occur when running mc in tmux, where TERM=screen.

When mc is compiled with --with-screen=ncurses, it occurs on the console, but not in an xterm in X11 (note that TERM=xterm in both). It also doesn't occur when running mc in a tmux, where TERM=screen.

Note that this was previously a problem on FreeBSD, as was fixed with this patch:

--- ./lib/tty/win.c.orig        2013-09-02 19:13:32.000000000 +0200
+++ ./lib/tty/win.c     2013-12-07 10:33:20.000000000 +0100
@@ -96,7 +96,7 @@
 void
 do_enter_ca_mode (void)
 {
-    if (mc_global.tty.xterm_flag && smcup != NULL)
+    if (mc_global.tty.xterm_flag)
     {
         fprintf (stdout, /* ESC_STR ")0" */ ESC_STR "7" ESC_STR "[?47h");
         fflush (stdout);
@@ -108,7 +108,7 @@
 void
 do_exit_ca_mode (void)
 {
-    if (mc_global.tty.xterm_flag && rmcup != NULL)
+    if (mc_global.tty.xterm_flag)
     {
         fprintf (stdout, ESC_STR "[?47l" ESC_STR "8" ESC_STR "[m");
         fflush (stdout);

However, with change c1975a this FreeBSD patch has been altered to the following:

--- lib/tty/tty-ncurses.c.orig  2016-05-07 15:42:52 UTC
+++ lib/tty/tty-ncurses.c
@@ -233,7 +233,7 @@ tty_shutdown (void)
 void
 tty_enter_ca_mode (void)
 {
-    if (mc_global.tty.xterm_flag && smcup != NULL)
+    if (mc_global.tty.xterm_flag)
     {
         fprintf (stdout, /* ESC_STR ")0" */ ESC_STR "7" ESC_STR "[?47h");
         fflush (stdout);
@@ -245,7 +245,7 @@ tty_enter_ca_mode (void)
 void
 tty_exit_ca_mode (void)
 {
-    if (mc_global.tty.xterm_flag && rmcup != NULL)
+    if (mc_global.tty.xterm_flag)
     {
         fprintf (stdout, ESC_STR "[?47l" ESC_STR "8" ESC_STR "[m");
         fflush (stdout);

Note that this change now only applies to NCURSES, and not to SLANG, which I believe is the cause of this problem.

Change History

comment:1 Changed 3 years ago by andrew_b

  • Status changed from new to closed
  • Resolution set to duplicate
  • Milestone Future Releases deleted

Closed as duplicate of #2633.

Note: See TracTickets for help on using tickets.