Placing the terminal types in FTerm in a separate structur

This commit is contained in:
Markus Gans 2018-04-19 01:55:17 +02:00
parent 06627f6737
commit b619f6bec5
4 changed files with 248 additions and 255 deletions

View File

@ -1,3 +1,6 @@
2017-04-19 Markus Gans <guru.mail@muenster.de>
* Placing the terminal types in FTerm in a separate structure
2017-04-15 Markus Gans <guru.mail@muenster.de>
* Fake-reverse bugfix in FOptiAttr
* Strict use of fc::colornames in FOptiAttr

View File

@ -210,12 +210,13 @@ class FTerm
static bool isCygwinTerminal();
static bool isMinttyTerm();
static bool isLinuxTerm();
static bool isNetBSDTerm();
static bool isOpenBSDTerm();
static bool isScreenTerm();
static bool isTmuxTerm();
static bool isInputDataPending();
static bool isNewFont();
static bool isUTF8();
static bool isUTF8_linux_terminal();
// Mutators
static bool setCursorOptimisation (bool);
@ -566,24 +567,6 @@ class FTerm
static bool ascii_console;
static bool color256;
static bool monochron;
static bool xterm_terminal;
static bool ansi_terminal;
static bool rxvt_terminal;
static bool urxvt_terminal;
static bool mlterm_terminal;
static bool putty_terminal;
static bool kde_konsole;
static bool gnome_terminal;
static bool kterm_terminal;
static bool tera_terminal;
static bool sun_terminal;
static bool cygwin_terminal;
static bool mintty_terminal;
static bool linux_terminal;
static bool netbsd_terminal;
static bool openbsd_terminal;
static bool screen_terminal;
static bool tmux_terminal;
static char termtype[256];
static char termfilename[256];
static char* locale_name;
@ -619,6 +602,32 @@ class FTerm
static const FString* answer_back;
static const FString* sec_da;
static struct terminalType
{
// byte #0
uInt8 xterm : 1;
uInt8 ansi : 1;
uInt8 rxvt : 1;
uInt8 urxvt : 1;
uInt8 mlterm : 1;
uInt8 putty : 1;
uInt8 kde_konsole : 1;
uInt8 gnome_terminal : 1;
// byte #1
uInt8 kterm : 1;
uInt8 tera_term : 1;
uInt8 sun : 1;
uInt8 cygwin : 1;
uInt8 mintty : 1;
uInt8 linux_con : 1;
uInt8 netbsd_con : 1;
uInt8 openbsd_con : 1;
// byte #2
uInt8 screen : 1;
uInt8 tmux : 1;
uInt8 : 6; // padding bits
} terminal_type;
static struct colorEnv
{
void setDefault()
@ -722,67 +731,75 @@ inline bool FTerm::isMonochron()
//----------------------------------------------------------------------
inline bool FTerm::isXTerminal()
{ return xterm_terminal; }
{ return terminal_type.xterm; }
//----------------------------------------------------------------------
inline bool FTerm::isAnsiTerminal()
{ return ansi_terminal; }
{ return terminal_type.ansi; }
//----------------------------------------------------------------------
inline bool FTerm::isRxvtTerminal()
{ return rxvt_terminal; }
{ return terminal_type.rxvt; }
//----------------------------------------------------------------------
inline bool FTerm::isUrxvtTerminal()
{ return urxvt_terminal; }
{ return terminal_type.urxvt; }
//----------------------------------------------------------------------
inline bool FTerm::isMltermTerminal()
{ return mlterm_terminal; }
{ return terminal_type.mlterm; }
//----------------------------------------------------------------------
inline bool FTerm::isPuttyTerminal()
{ return putty_terminal; }
{ return terminal_type.putty; }
//----------------------------------------------------------------------
inline bool FTerm::isKdeTerminal()
{ return kde_konsole; }
{ return terminal_type.kde_konsole; }
//----------------------------------------------------------------------
inline bool FTerm::isGnomeTerminal()
{ return gnome_terminal; }
{ return terminal_type.gnome_terminal; }
//----------------------------------------------------------------------
inline bool FTerm::isKtermTerminal()
{ return kterm_terminal; }
{ return terminal_type.kterm; }
//----------------------------------------------------------------------
inline bool FTerm::isTeraTerm()
{ return tera_terminal; }
{ return terminal_type.tera_term; }
//----------------------------------------------------------------------
inline bool FTerm::isSunTerminal()
{ return sun_terminal; }
{ return terminal_type.sun; }
//----------------------------------------------------------------------
inline bool FTerm::isCygwinTerminal()
{ return cygwin_terminal; }
{ return terminal_type.cygwin; }
//----------------------------------------------------------------------
inline bool FTerm::isMinttyTerm()
{ return mintty_terminal; }
{ return terminal_type.mintty; }
//----------------------------------------------------------------------
inline bool FTerm::isLinuxTerm()
{ return linux_terminal; }
{ return terminal_type.linux_con; }
//----------------------------------------------------------------------
inline bool FTerm::isNetBSDTerm()
{ return terminal_type.netbsd_con; }
//----------------------------------------------------------------------
inline bool FTerm::isOpenBSDTerm()
{ return terminal_type.openbsd_con; }
//----------------------------------------------------------------------
inline bool FTerm::isScreenTerm()
{ return screen_terminal; }
{ return terminal_type.screen; }
//----------------------------------------------------------------------
inline bool FTerm::isTmuxTerm()
{ return tmux_terminal; }
{ return terminal_type.tmux; }
//----------------------------------------------------------------------
inline bool FTerm::isInputDataPending()
@ -796,10 +813,6 @@ inline bool FTerm::isNewFont()
inline bool FTerm::isUTF8()
{ return utf8_state; }
//----------------------------------------------------------------------
inline bool FTerm::isUTF8_linux_terminal()
{ return utf8_linux_terminal; }
//----------------------------------------------------------------------
inline bool FTerm::setCursorOptimisation (bool on)
{ return cursor_optimisation = ( on ) ? true : false; }

View File

@ -3,7 +3,7 @@
* *
* This file is part of the Final Cut widget toolkit *
* *
* Copyright 2012-2017 Markus Gans *
* Copyright 2012-2018 Markus Gans *
* *
* The Final Cut is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public License *
@ -765,7 +765,7 @@ void FLineEdit::drawInputField()
show_text = text.mid(uInt(1 + text_offset), uInt(getWidth() - 2));
if ( isUTF8_linux_terminal() )
if ( isLinuxTerm() && hasUTF8() )
{
setUTF8(true);

File diff suppressed because it is too large Load Diff