From c1975a3a35d4a09381ec2c47a15386122f2fb343 Mon Sep 17 00:00:00 2001 From: Yuri Khan Date: Tue, 3 May 2016 16:08:01 +0600 Subject: [PATCH] Do not duplicate alternate screen switching. S-Lang already handles that in SLsmg_init_smg() and SLsmg_reset_smg(). Signed-off-by: Andrew Borodin --- lib/tty/tty-ncurses.c | 24 ++++++++++++++++++++++++ lib/tty/tty-slang.c | 16 ++++++++++++++++ lib/tty/tty.h | 3 +++ lib/tty/win.c | 24 ------------------------ lib/tty/win.h | 3 --- lib/widget/dialog-switch.c | 4 ---- 6 files changed, 43 insertions(+), 31 deletions(-) diff --git a/lib/tty/tty-ncurses.c b/lib/tty/tty-ncurses.c index 0a44b1625..110d26c23 100644 --- a/lib/tty/tty-ncurses.c +++ b/lib/tty/tty-ncurses.c @@ -230,6 +230,30 @@ tty_shutdown (void) /* --------------------------------------------------------------------------------------------- */ +void +tty_enter_ca_mode (void) +{ + if (mc_global.tty.xterm_flag && smcup != NULL) + { + fprintf (stdout, /* ESC_STR ")0" */ ESC_STR "7" ESC_STR "[?47h"); + fflush (stdout); + } +} + +/* --------------------------------------------------------------------------------------------- */ + +void +tty_exit_ca_mode (void) +{ + if (mc_global.tty.xterm_flag && rmcup != NULL) + { + fprintf (stdout, ESC_STR "[?47l" ESC_STR "8" ESC_STR "[m"); + fflush (stdout); + } +} + +/* --------------------------------------------------------------------------------------------- */ + void tty_change_screen_size (void) { diff --git a/lib/tty/tty-slang.c b/lib/tty/tty-slang.c index 279d69641..b296119ac 100644 --- a/lib/tty/tty-slang.c +++ b/lib/tty/tty-slang.c @@ -363,6 +363,22 @@ tty_shutdown (void) /* --------------------------------------------------------------------------------------------- */ +void +tty_enter_ca_mode (void) +{ + /* S-Lang handles alternate screen switching and cursor position saving */ +} + +/* --------------------------------------------------------------------------------------------- */ + +void +tty_exit_ca_mode (void) +{ + /* S-Lang handles alternate screen switching and cursor position restoring */ +} + +/* --------------------------------------------------------------------------------------------- */ + void tty_change_screen_size (void) { diff --git a/lib/tty/tty.h b/lib/tty/tty.h index 7a40553de..4b162ded9 100644 --- a/lib/tty/tty.h +++ b/lib/tty/tty.h @@ -137,5 +137,8 @@ extern void tty_change_screen_size (void); extern int mc_tty_normalize_lines_char (const char *); +extern void tty_enter_ca_mode (void); +extern void tty_exit_ca_mode (void); + /*** inline functions ****************************************************************************/ #endif /* MC_TTY_H */ diff --git a/lib/tty/win.c b/lib/tty/win.c index 790b575c8..86150d149 100644 --- a/lib/tty/win.c +++ b/lib/tty/win.c @@ -92,30 +92,6 @@ anything_ready (void) /*** public functions ****************************************************************************/ /* --------------------------------------------------------------------------------------------- */ -void -tty_enter_ca_mode (void) -{ - if (mc_global.tty.xterm_flag && smcup != NULL) - { - fprintf (stdout, /* ESC_STR ")0" */ ESC_STR "7" ESC_STR "[?47h"); - fflush (stdout); - } -} - -/* --------------------------------------------------------------------------------------------- */ - -void -tty_exit_ca_mode (void) -{ - if (mc_global.tty.xterm_flag && rmcup != NULL) - { - fprintf (stdout, ESC_STR "[?47l" ESC_STR "8" ESC_STR "[m"); - fflush (stdout); - } -} - -/* --------------------------------------------------------------------------------------------- */ - void show_rxvt_contents (int starty, unsigned char y1, unsigned char y2) { diff --git a/lib/tty/win.h b/lib/tty/win.h index ea71f12ef..4c3160783 100644 --- a/lib/tty/win.h +++ b/lib/tty/win.h @@ -17,9 +17,6 @@ /*** declarations of public functions ************************************************************/ -void tty_enter_ca_mode (void); -void tty_exit_ca_mode (void); - void show_rxvt_contents (int starty, unsigned char y1, unsigned char y2); gboolean look_for_rxvt_extensions (void); diff --git a/lib/widget/dialog-switch.c b/lib/widget/dialog-switch.c index 062a037b9..c4a639299 100644 --- a/lib/widget/dialog-switch.c +++ b/lib/widget/dialog-switch.c @@ -35,9 +35,6 @@ #include "lib/global.h" #include "lib/tty/tty.h" /* LINES, COLS */ #include "lib/tty/color.h" /* tty_set_normal_attrs() */ -#ifdef HAVE_SLANG -#include "lib/tty/win.h" /* tty_enter_ca_mode() */ -#endif #include "lib/widget.h" #include "lib/event.h" @@ -372,7 +369,6 @@ dialog_change_screen_size (void) tty_change_screen_size (); #ifdef HAVE_SLANG - tty_enter_ca_mode (); tty_keypad (TRUE); tty_nodelay (FALSE); #endif