Moved xterm_flag global variable to mc_global.tty.xterm_flag
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
Этот коммит содержится в:
родитель
387bad2c7e
Коммит
8d44ed297b
@ -105,6 +105,7 @@ mc_global_t mc_global = {
|
||||
|
||||
.winch_flag = FALSE,
|
||||
.command_line_colors = NULL,
|
||||
.xterm_flag = FALSE,
|
||||
},
|
||||
|
||||
.vfs =
|
||||
|
@ -255,6 +255,9 @@ typedef struct
|
||||
/* colors specified on the command line: they override any other setting */
|
||||
char *command_line_colors;
|
||||
|
||||
/* This flag is set by xterm detection routine in function main() */
|
||||
/* It is used by function view_other_cmd() */
|
||||
gboolean xterm_flag;
|
||||
} tty;
|
||||
|
||||
struct
|
||||
|
@ -46,7 +46,6 @@
|
||||
#include "tty-internal.h" /* mouse_enabled */
|
||||
#include "mouse.h"
|
||||
#include "key.h"
|
||||
#include "win.h" /* xterm_flag */
|
||||
|
||||
#include "lib/widget.h" /* mc_refresh() */
|
||||
|
||||
@ -530,7 +529,9 @@ static Window x11_window;
|
||||
|
||||
static KeySortType has_been_sorted = KEY_NOSORT;
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
static const size_t key_conv_tab_size = G_N_ELEMENTS (key_name_conv_tab) - 1;
|
||||
/* *INDENT-ON* */
|
||||
|
||||
static const key_code_name_t *key_conv_tab_sorted[G_N_ELEMENTS (key_name_conv_tab) - 1];
|
||||
|
||||
@ -1268,7 +1269,7 @@ init_key (void)
|
||||
define_sequences (mc_default_keys);
|
||||
|
||||
/* Terminfo on irix does not have some keys */
|
||||
if (xterm_flag
|
||||
if (mc_global.tty.xterm_flag
|
||||
|| (term != NULL
|
||||
&& (strncmp (term, "iris-ansi", 9) == 0
|
||||
|| strncmp (term, "xterm", 5) == 0
|
||||
@ -1480,8 +1481,7 @@ lookup_key (const char *name, char **label)
|
||||
}
|
||||
else if (k < 128)
|
||||
{
|
||||
if ((k >= 'A') || (lc_index < 0)
|
||||
|| (key_conv_tab_sorted[lc_index]->shortcut == NULL))
|
||||
if ((k >= 'A') || (lc_index < 0) || (key_conv_tab_sorted[lc_index]->shortcut == NULL))
|
||||
g_string_append_c (s, (gchar) g_ascii_tolower ((gchar) k));
|
||||
else
|
||||
g_string_append (s, key_conv_tab_sorted[lc_index]->shortcut);
|
||||
@ -1577,8 +1577,7 @@ lookup_key_by_code (const int keycode)
|
||||
}
|
||||
else if (k < 128)
|
||||
{
|
||||
if ((k >= 'A') || (key_idx < 0)
|
||||
|| (key_conv_tab_sorted[key_idx]->name == NULL))
|
||||
if ((k >= 'A') || (key_idx < 0) || (key_conv_tab_sorted[key_idx]->name == NULL))
|
||||
g_string_append_c (s, (gchar) k);
|
||||
else
|
||||
g_string_append (s, key_conv_tab_sorted[key_idx]->name);
|
||||
@ -2103,7 +2102,7 @@ learn_key (void)
|
||||
void
|
||||
numeric_keypad_mode (void)
|
||||
{
|
||||
if (mc_global.tty.console_flag || xterm_flag)
|
||||
if (mc_global.tty.console_flag || mc_global.tty.xterm_flag)
|
||||
{
|
||||
fputs ("\033>", stdout);
|
||||
fflush (stdout);
|
||||
@ -2115,7 +2114,7 @@ numeric_keypad_mode (void)
|
||||
void
|
||||
application_keypad_mode (void)
|
||||
{
|
||||
if (mc_global.tty.console_flag || xterm_flag)
|
||||
if (mc_global.tty.console_flag || mc_global.tty.xterm_flag)
|
||||
{
|
||||
fputs ("\033=", stdout);
|
||||
fflush (stdout);
|
||||
|
@ -40,10 +40,6 @@
|
||||
|
||||
/*** global variables ****************************************************************************/
|
||||
|
||||
/* This flag is set by xterm detection routine in function main() */
|
||||
/* It is used by function view_other_cmd() */
|
||||
gboolean xterm_flag = FALSE;
|
||||
|
||||
char *smcup = NULL;
|
||||
char *rmcup = NULL;
|
||||
|
||||
@ -96,7 +92,7 @@ anything_ready (void)
|
||||
void
|
||||
do_enter_ca_mode (void)
|
||||
{
|
||||
if (xterm_flag && smcup != NULL)
|
||||
if (mc_global.tty.xterm_flag && smcup != NULL)
|
||||
{
|
||||
fprintf (stdout, /* ESC_STR ")0" */ ESC_STR "7" ESC_STR "[?47h");
|
||||
fflush (stdout);
|
||||
@ -108,7 +104,7 @@ do_enter_ca_mode (void)
|
||||
void
|
||||
do_exit_ca_mode (void)
|
||||
{
|
||||
if (xterm_flag && rmcup != NULL)
|
||||
if (mc_global.tty.xterm_flag && rmcup != NULL)
|
||||
{
|
||||
fprintf (stdout, ESC_STR "[?47l" ESC_STR "8" ESC_STR "[m");
|
||||
fflush (stdout);
|
||||
@ -123,7 +119,7 @@ show_rxvt_contents (int starty, unsigned char y1, unsigned char y2)
|
||||
unsigned char *k;
|
||||
int bytes, i, j, cols = 0;
|
||||
|
||||
y1 += (mc_global.keybar_visible != 0); /* i don't knwo why we need this - paul */
|
||||
y1 += (mc_global.keybar_visible != 0); /* i don't knwo why we need this - paul */
|
||||
y2 += (mc_global.keybar_visible != 0);
|
||||
while (anything_ready ())
|
||||
tty_lowlevel_getch ();
|
||||
|
@ -15,8 +15,6 @@
|
||||
|
||||
/*** global variables defined in .c file *********************************************************/
|
||||
|
||||
extern gboolean xterm_flag;
|
||||
|
||||
/*** declarations of public functions ************************************************************/
|
||||
|
||||
void do_enter_ca_mode (void);
|
||||
|
@ -41,7 +41,6 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include "lib/global.h"
|
||||
#include "lib/tty/win.h" /* xterm_flag */
|
||||
#include "lib/mcconfig.h"
|
||||
#include "lib/fileloc.h"
|
||||
#include "lib/vfs/vfs.h"
|
||||
@ -93,7 +92,7 @@ static inline int
|
||||
is_8bit_printable (unsigned char c)
|
||||
{
|
||||
/* "Full 8 bits output" doesn't work on xterm */
|
||||
if (xterm_flag)
|
||||
if (mc_global.tty.xterm_flag)
|
||||
return is_iso_printable (c);
|
||||
|
||||
return (c > 31 && c != 127 && c != 155);
|
||||
@ -395,6 +394,7 @@ void
|
||||
size_trunc_len (char *buffer, unsigned int len, uintmax_t size, int units, gboolean use_si)
|
||||
{
|
||||
/* Avoid taking power for every file. */
|
||||
/* *INDENT-OFF* */
|
||||
static const uintmax_t power10[] = {
|
||||
/* we hope that size of uintmax_t is 4 bytes at least */
|
||||
1ULL,
|
||||
@ -427,6 +427,7 @@ size_trunc_len (char *buffer, unsigned int len, uintmax_t size, int units, gbool
|
||||
*/
|
||||
#endif
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
static const char *const suffix[] = { "", "K", "M", "G", "T", "P", "E", "Z", "Y", NULL };
|
||||
static const char *const suffix_lc[] = { "", "k", "m", "g", "t", "p", "e", "z", "y", NULL };
|
||||
int j = 0;
|
||||
|
@ -81,7 +81,7 @@ edition_pre_exec (void)
|
||||
clr_scr ();
|
||||
else
|
||||
{
|
||||
if (!(mc_global.tty.console_flag || xterm_flag))
|
||||
if (!(mc_global.tty.console_flag || mc_global.tty.xterm_flag))
|
||||
printf ("\n\n");
|
||||
}
|
||||
|
||||
@ -158,7 +158,7 @@ do_execute (const char *lc_shell, const char *command, int flags)
|
||||
if (!(flags & EXECUTE_INTERNAL))
|
||||
{
|
||||
if ((pause_after_run == pause_always
|
||||
|| (pause_after_run == pause_on_dumb_terminals && !xterm_flag
|
||||
|| (pause_after_run == pause_on_dumb_terminals && !mc_global.tty.xterm_flag
|
||||
&& !mc_global.tty.console_flag)) && quit == 0
|
||||
#ifdef HAVE_SUBSHELL_SUPPORT
|
||||
&& subshell_state != RUNNING_COMMAND
|
||||
|
@ -1268,7 +1268,7 @@ view_other_cmd (void)
|
||||
{
|
||||
static int message_flag = TRUE;
|
||||
|
||||
if (!xterm_flag && !mc_global.tty.console_flag && !mc_global.tty.use_subshell
|
||||
if (!mc_global.tty.xterm_flag && !mc_global.tty.console_flag && !mc_global.tty.use_subshell
|
||||
&& !output_starts_shell)
|
||||
{
|
||||
if (message_flag)
|
||||
|
@ -43,7 +43,6 @@
|
||||
|
||||
#include "lib/tty/tty.h"
|
||||
#include "lib/tty/key.h" /* KEY_M_* masks */
|
||||
#include "lib/tty/win.h" /* xterm_flag */
|
||||
#include "lib/skin.h"
|
||||
#include "lib/util.h"
|
||||
|
||||
@ -1408,7 +1407,7 @@ midnight_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, void
|
||||
return MSG_HANDLED;
|
||||
}
|
||||
|
||||
if ((!alternate_plus_minus || !(mc_global.tty.console_flag || xterm_flag))
|
||||
if ((!alternate_plus_minus || !(mc_global.tty.console_flag || mc_global.tty.xterm_flag))
|
||||
&& !quote && !current_panel->searching)
|
||||
{
|
||||
if (!only_leading_plus_minus)
|
||||
|
@ -44,7 +44,6 @@
|
||||
#include "lib/event.h"
|
||||
#include "lib/tty/tty.h"
|
||||
#include "lib/tty/key.h" /* For init_key() */
|
||||
#include "lib/tty/win.h" /* xterm_flag */
|
||||
#include "lib/skin.h"
|
||||
#include "lib/filehighlight.h"
|
||||
#include "lib/fileloc.h"
|
||||
@ -338,7 +337,7 @@ update_xterm_title_path (void)
|
||||
char *login = NULL;
|
||||
int res = 0;
|
||||
|
||||
if (xterm_flag && xterm_title)
|
||||
if (mc_global.tty.xterm_flag && xterm_title)
|
||||
{
|
||||
path = strip_home_and_password (current_panel->cwd);
|
||||
res = gethostname (host, sizeof (host));
|
||||
@ -413,10 +412,10 @@ main (int argc, char *argv[])
|
||||
|
||||
/* check terminal type
|
||||
* $TEMR must be set and not empty
|
||||
* xterm_flag is used in init_key() and tty_init()
|
||||
* mc_global.tty.xterm_flag is used in init_key() and tty_init()
|
||||
* Do this after mc_args_handle() where mc_args__force_xterm is set up.
|
||||
*/
|
||||
xterm_flag = tty_check_term (mc_args__force_xterm);
|
||||
mc_global.tty.xterm_flag = tty_check_term (mc_args__force_xterm);
|
||||
|
||||
/* NOTE: This has to be called before tty_init or whatever routine
|
||||
calls any define_sequence */
|
||||
@ -443,7 +442,7 @@ main (int argc, char *argv[])
|
||||
/* Must be done before init_subshell, to set up the terminal size: */
|
||||
/* FIXME: Should be removed and LINES and COLS computed on subshell */
|
||||
tty_init (mc_global.args.slow_terminal, mc_global.args.ugly_line_drawing, !mc_args__nomouse,
|
||||
xterm_flag);
|
||||
mc_global.tty.xterm_flag);
|
||||
|
||||
load_setup ();
|
||||
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user