id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	blockedby	blocking	branch_state	votes
3659	Subshell clears the terminal before showing prompt on FreeBSD	woodsb02		"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 [http://www.midnight-commander.org/changeset/c1975a3a35d4a09381ec2c47a15386122f2fb343 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."	defect	closed	major		mc-core	master	duplicate					no branch	
