Better support for kitty terminals

This commit is contained in:
Markus Gans 2021-04-11 21:00:06 +02:00
parent d5ec54dcfd
commit 8a7ce330a3
22 changed files with 372 additions and 219 deletions

View File

@ -1,3 +1,6 @@
2021-04-11 Markus Gans <guru.mail@muenster.de>
* Better support for kitty terminals
2021-03-31 Markus Gans <guru.mail@muenster.de>
* argv is now stored internally as a std::vector container

View File

@ -435,6 +435,13 @@ bool FTerm::isMltermTerminal()
return term_detection->isMltermTerminal();
}
//----------------------------------------------------------------------
bool FTerm::isKittyTerminal()
{
const auto& term_detection = FTerm::getFTermDetection();
return term_detection->isKittyTerminal();
}
//----------------------------------------------------------------------
bool FTerm::isNewFont()
{

View File

@ -102,13 +102,14 @@ bool FTermcap::getFlag (const std::string& cap)
int FTermcap::getNumber (const std::string& cap)
{
auto num = ::tgetnum(C_STR(cap.data()));
return ( num > 0) ? num : 0;
return num > 0 ? num : 0;
}
//----------------------------------------------------------------------
char* FTermcap::getString (const std::string& cap)
{
return ::tgetstr(C_STR(cap.data()), reinterpret_cast<char**>(&string_buf));
auto string = ::tgetstr(C_STR(cap.data()), reinterpret_cast<char**>(&string_buf));
return ( string && string[0] != '\0' ) ? string : nullptr;
}
//----------------------------------------------------------------------
@ -428,7 +429,7 @@ void FTermcap::termcapKeys()
// Read termcap key sequences up to the self-defined values
for (auto&& entry : fc::fkey_cap_table)
{
if ( entry.string != nullptr )
if ( entry.string != nullptr ) // String is already set
break;
entry.string = getString(entry.tname);

View File

@ -60,6 +60,10 @@ void FTermcapQuirks::terminalFixup()
{
vte();
}
else if ( td->isKittyTerminal() )
{
kitty();
}
else if ( td->isTeraTerm() )
{
teraterm();
@ -256,23 +260,13 @@ void FTermcapQuirks::vte()
TCAP(t_exit_underline_mode) = CSI "24m";
if ( term_detection->getGnomeTerminalID() >= 5300 ) // vte >= 0.53.0
{
if ( TCAP(t_enter_ca_mode)
&& ! std::strstr(TCAP(t_enter_ca_mode), "\033[22;0;0t") )
{
// Save the cursor position, enter alternate screen buffer
// and save xterm icon and window title on stack
TCAP(t_enter_ca_mode) = CSI "?1049h" CSI "22;0;0t";
caModeExtension();
}
if ( TCAP(t_exit_ca_mode)
&& ! std::strstr(TCAP(t_exit_ca_mode), "\033[23;0;0t") )
//----------------------------------------------------------------------
void FTermcapQuirks::kitty()
{
// Use normal screen buffer, restore the cursor position
// and restore xterm icon and window title from stack
TCAP(t_exit_ca_mode) = CSI "?1049l" CSI "23;0;0t";
}
}
caModeExtension();
}
//----------------------------------------------------------------------
@ -520,6 +514,26 @@ void FTermcapQuirks::general()
TCAP(t_cursor_address) = CSI "%i%p1%d;%p2%dH";
}
//----------------------------------------------------------------------
inline void FTermcapQuirks::caModeExtension()
{
if ( TCAP(t_enter_ca_mode)
&& ! std::strstr(TCAP(t_enter_ca_mode), "\033[22;0;0t") )
{
// Save the cursor position, enter alternate screen buffer
// and save xterm icon and window title on stack
TCAP(t_enter_ca_mode) = CSI "?1049h" CSI "22;0;0t";
}
if ( TCAP(t_exit_ca_mode)
&& ! std::strstr(TCAP(t_exit_ca_mode), "\033[23;0;0t") )
{
// Use normal screen buffer, restore the cursor position
// and restore xterm icon and window title from stack
TCAP(t_exit_ca_mode) = CSI "?1049l" CSI "23;0;0t";
}
}
//----------------------------------------------------------------------
void FTermcapQuirks::ecma48()
{

View File

@ -53,6 +53,7 @@ namespace finalcut
// static class attributes
FTermDetection::FTerminalType FTermDetection::terminal_type{};
FTermDetection::colorEnv FTermDetection::color_env{};
FTermDetection::kittyVersion FTermDetection::kitty_version{};
FTermDetection::secondaryDA FTermDetection::secondary_da{};
char FTermDetection::termtype[256]{};
char FTermDetection::ttytypename[256]{};
@ -346,6 +347,10 @@ void FTermDetection::termtypeAnalysis()
// NetBSD workstation console
if ( std::strncmp(termtype, "wsvt25", 6) == 0 )
terminal_type.netbsd_con = true;
// kitty
if ( std::strncmp(termtype, "xterm-kitty", 11) == 0 )
terminal_type.kitty = true;
}
//----------------------------------------------------------------------
@ -450,6 +455,7 @@ bool FTermDetection::get256colorEnvString()
color_env.string5 = std::getenv("KONSOLE_DBUS_SESSION");
color_env.string6 = std::getenv("KONSOLE_DCOP");
color_env.string7 = std::getenv("COLORFGBG");
color_env.string7 = std::getenv("KITTY_WINDOW_ID");
if ( color_env.string1 != nullptr )
return true;
@ -472,6 +478,9 @@ bool FTermDetection::get256colorEnvString()
if ( color_env.string7 != nullptr )
return true;
if ( color_env.string8 != nullptr )
return true;
return false;
}
@ -964,7 +973,12 @@ inline const char* FTermDetection::secDA_Analysis_1 (const char current_termtype
// Terminal ID 1 - DEC VT220
const char* new_termtype = current_termtype;
if ( isKittyTerminal() )
new_termtype = secDA_Analysis_kitty(new_termtype);
else
new_termtype = secDA_Analysis_vte(new_termtype);
return new_termtype;
}
@ -1119,4 +1133,23 @@ inline const char* FTermDetection::secDA_Analysis_vte (const char current_termty
return new_termtype;
}
//----------------------------------------------------------------------
inline const char* FTermDetection::secDA_Analysis_kitty (const char current_termtype[])
{
// kitty
const char* new_termtype = current_termtype;
if ( secondary_da.terminal_id_version > 3999 )
{
// All kitty terminals can use 256 colors
color256 = true;
new_termtype = "xterm-kitty";
kitty_version.primary = secondary_da.terminal_id_version - 4000;
kitty_version.secondary = secondary_da.terminal_id_hardware;
}
return new_termtype;
}
} // namespace finalcut

View File

@ -3,7 +3,7 @@
* *
* This file is part of the FINAL CUT widget toolkit *
* *
* Copyright 2019-2020 Markus Gans *
* Copyright 2019-2021 Markus Gans *
* *
* FINAL CUT is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as *
@ -55,15 +55,6 @@ class FColorPair
, bg_color{bg}
{ }
// Copy constructor
FColorPair (const FColorPair& pair) = default;
// Destructor
~FColorPair() = default;
// copy assignment operator (=)
FColorPair& operator = (const FColorPair&) = default;
// Accessor
FString getClassName() const
{ return "FColorPair"; }

View File

@ -165,9 +165,6 @@ class FData : public FDataAccess
, value_ref{value}
{ }
// Destructor
~FData() noexcept override = default;
FData (const FData& d) // Copy constructor
: value{d.value}
, value_ref{d.isInitializedCopy() ? std::ref(value) : d.value_ref}

View File

@ -3,7 +3,7 @@
* *
* This file is part of the FINAL CUT widget toolkit *
* *
* Copyright 2014-2020 Markus Gans *
* Copyright 2014-2021 Markus Gans *
* *
* FINAL CUT is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as *
@ -101,7 +101,6 @@ class FPoint;
class FEvent // event base class
{
public:
FEvent() = default;
explicit FEvent(Event);
Event getType() const;
bool isQueued() const;
@ -125,9 +124,7 @@ class FEvent // event base class
class FKeyEvent : public FEvent // keyboard event
{
public:
FKeyEvent() = default;
FKeyEvent (Event, FKey);
~FKeyEvent() = default;
FKey key() const;
bool isAccepted() const;
@ -147,10 +144,8 @@ class FKeyEvent : public FEvent // keyboard event
class FMouseEvent : public FEvent // mouse event
{
public:
FMouseEvent() = default;
FMouseEvent (Event, const FPoint&, const FPoint&, MouseButton);
FMouseEvent (Event, const FPoint&, MouseButton);
~FMouseEvent() = default;
const FPoint& getPos() const;
const FPoint& getTermPos() const;
@ -174,10 +169,8 @@ class FMouseEvent : public FEvent // mouse event
class FWheelEvent : public FEvent // wheel event
{
public:
FWheelEvent() = default;
FWheelEvent (Event, const FPoint&, MouseWheel);
FWheelEvent (Event, const FPoint&, const FPoint&, MouseWheel);
~FWheelEvent() = default;
const FPoint& getPos() const;
const FPoint& getTermPos() const;
@ -201,9 +194,7 @@ class FWheelEvent : public FEvent // wheel event
class FFocusEvent : public FEvent // focus event
{
public:
FFocusEvent() = default;
explicit FFocusEvent (Event);
~FFocusEvent() = default;
bool gotFocus() const;
bool lostFocus() const;
@ -227,10 +218,8 @@ class FWidget; // class forward declaration
class FAccelEvent : public FEvent // focus event
{
public:
FAccelEvent() = default;
FAccelEvent (Event, FWidget*);
FAccelEvent (const FAccelEvent&) = delete;
~FAccelEvent() = default;
FAccelEvent& operator = (const FAccelEvent&) = delete;
FWidget* focusedWidget() const;
@ -251,9 +240,7 @@ class FAccelEvent : public FEvent // focus event
class FResizeEvent : public FEvent // resize event
{
public:
FResizeEvent() = default;
explicit FResizeEvent (Event);
~FResizeEvent() = default;
bool isAccepted() const;
void accept();
@ -271,9 +258,7 @@ class FResizeEvent : public FEvent // resize event
class FShowEvent : public FEvent // show event
{
public:
FShowEvent() = default;
explicit FShowEvent (Event);
~FShowEvent() = default;
};
@ -284,9 +269,7 @@ class FShowEvent : public FEvent // show event
class FHideEvent : public FEvent // hide event
{
public:
FHideEvent() = default;
explicit FHideEvent (Event);
~FHideEvent() = default;
};
@ -297,9 +280,7 @@ class FHideEvent : public FEvent // hide event
class FCloseEvent : public FEvent // close event
{
public:
FCloseEvent() = default;
explicit FCloseEvent(Event);
~FCloseEvent() = default;
bool isAccepted() const;
void accept();
@ -317,9 +298,7 @@ class FCloseEvent : public FEvent // close event
class FTimerEvent : public FEvent // timer event
{
public:
FTimerEvent() = default;
FTimerEvent (Event, int);
~FTimerEvent() = default;
int getTimerId() const;
@ -335,14 +314,10 @@ class FTimerEvent : public FEvent // timer event
class FUserEvent : public FEvent // user event
{
public:
FUserEvent() = default;
// Disable copy constructor
FUserEvent (const FUserEvent&) = delete;
FUserEvent (Event, int);
~FUserEvent() = default;
// Disable copy assignment operator (=)
FUserEvent& operator = (const FUserEvent&) = delete;

View File

@ -240,6 +240,7 @@ class FTerm final
static bool isTmuxTerm();
static bool isKtermTerminal();
static bool isMltermTerminal();
static bool isKittyTerminal();
static bool isNewFont();
static bool isInitialized();
static bool isCursorHideable();

View File

@ -3,7 +3,7 @@
* *
* This file is part of the FINAL CUT widget toolkit *
* *
* Copyright 2018-2020 Markus Gans *
* Copyright 2018-2021 Markus Gans *
* *
* FINAL CUT is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as *
@ -70,11 +70,13 @@ class FTermcapQuirks final
static void xterm();
static void rxvt();
static void vte();
static void kitty();
static void putty();
static void teraterm();
static void sunConsole();
static void screen();
static void general();
static void caModeExtension();
static void ecma48();
};

View File

@ -75,9 +75,12 @@ class FTermDetection final
uInt8 tmux : 1;
uInt8 kterm : 1;
uInt8 mlterm : 1;
uInt8 : 4; // padding bits
uInt8 kitty : 1;
uInt8 : 3; // padding bits
};
struct kittyVersion; // forward declaration
// Constructors
FTermDetection();
@ -94,6 +97,7 @@ class FTermDetection final
static FString getClassName();
static const char* getTermType();
static int getGnomeTerminalID();
static kittyVersion getKittyVersion();
FTerminalType& getTermTypeStruct();
#if DEBUG
@ -125,6 +129,7 @@ class FTermDetection final
static bool isTmuxTerm();
static bool isKtermTerminal();
static bool isMltermTerminal();
static bool isKittyTerminal();
static bool canDisplay256Colors();
static bool hasTerminalDetection();
static bool hasSetCursorStyleSupport();
@ -150,6 +155,7 @@ class FTermDetection final
static void setTmuxTerm (bool = true);
static void setKtermTerminal (bool = true);
static void setMltermTerminal (bool = true);
static void setKittyTerminal (bool = true);
static void setTerminalDetection (bool = true);
static void setTtyTypeFileName (const char[]);
@ -192,6 +198,7 @@ class FTermDetection final
static const char* secDA_Analysis_84 (const char[]);
static const char* secDA_Analysis_85 ();
static const char* secDA_Analysis_vte (const char[]);
static const char* secDA_Analysis_kitty (const char[]);
// Data members
#if DEBUG
@ -209,6 +216,7 @@ class FTermDetection final
static const FString* sec_da;
static FTerminalType terminal_type;
static colorEnv color_env;
static kittyVersion kitty_version;
static secondaryDA secondary_da;
};
@ -225,6 +233,16 @@ struct FTermDetection::colorEnv
char* string5{nullptr};
char* string6{nullptr};
char* string7{nullptr};
char* string8{nullptr};
};
//----------------------------------------------------------------------
// struct FTermDetection::KittyVersion
//----------------------------------------------------------------------
struct FTermDetection::kittyVersion
{
int primary{0};
int secondary{0};
};
//----------------------------------------------------------------------
@ -251,6 +269,10 @@ inline const char* FTermDetection::getTermType()
inline int FTermDetection::getGnomeTerminalID()
{ return gnome_terminal_id; }
//----------------------------------------------------------------------
inline FTermDetection::kittyVersion FTermDetection::getKittyVersion()
{ return kitty_version; }
//----------------------------------------------------------------------
inline FTermDetection::FTerminalType& FTermDetection::getTermTypeStruct()
{ return terminal_type; }
@ -297,6 +319,10 @@ inline bool FTermDetection::isUrxvtTerminal()
inline bool FTermDetection::isMltermTerminal()
{ return terminal_type.mlterm; }
//----------------------------------------------------------------------
inline bool FTermDetection::isKittyTerminal()
{ return terminal_type.kitty; }
//----------------------------------------------------------------------
inline bool FTermDetection::isPuttyTerminal()
{ return terminal_type.putty; }
@ -381,6 +407,10 @@ inline void FTermDetection::setUrxvtTerminal (bool enable)
inline void FTermDetection::setMltermTerminal (bool enable)
{ terminal_type.mlterm = enable; }
//----------------------------------------------------------------------
inline void FTermDetection::setKittyTerminal (bool enable)
{ terminal_type.kitty = enable; }
//----------------------------------------------------------------------
inline void FTermDetection::setPuttyTerminal (bool enable)
{ terminal_type.putty = enable; }

View File

@ -3,7 +3,7 @@
* *
* This file is part of the FINAL CUT widget toolkit *
* *
* Copyright 2018-2020 Markus Gans *
* Copyright 2018-2021 Markus Gans *
* *
* FINAL CUT is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as *
@ -81,18 +81,6 @@ class FTermFreeBSD final
// Using-declaration
using CursorStyle = FreeBSDConsoleCursorStyle;
// Constructors
FTermFreeBSD() = default;
// Disable copy constructor
FTermFreeBSD (const FTermFreeBSD&) = delete;
// Destructor
~FTermFreeBSD() = default;
// Disable copy assignment operator (=)
FTermFreeBSD& operator = (const FTermFreeBSD&) = delete;
// Accessors
FString getClassName() const;
static CursorStyle getCursorStyle();

View File

@ -3,7 +3,7 @@
* *
* This file is part of the FINAL CUT widget toolkit *
* *
* Copyright 2018-2020 Markus Gans *
* Copyright 2018-2021 Markus Gans *
* *
* FINAL CUT is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as *
@ -71,18 +71,6 @@ namespace finalcut
class FTermOpenBSD final
{
public:
// Constructors
FTermOpenBSD() = default;
// Disable copy constructor
FTermOpenBSD (const FTermOpenBSD&) = delete;
// Destructor
~FTermOpenBSD() noexcept = default;
// Disable copy assignment operator (=)
FTermOpenBSD& operator = (const FTermOpenBSD&) = delete;
// Accessor
FString getClassName() const;

View File

@ -48,18 +48,6 @@ class FString;
class FTermXTerminal final
{
public:
// Constructors
FTermXTerminal() = default;
// Disable copy constructor
FTermXTerminal (const FTermXTerminal&) = delete;
// Destructor
~FTermXTerminal() noexcept = default;
// Disable copy assignment operator (=)
FTermXTerminal& operator = (const FTermXTerminal&) = delete;
// Mutators
void redefineDefaultColors (bool = true);
void setCursorStyle (XTermCursorStyle);

View File

@ -3,7 +3,7 @@
* *
* This file is part of the FINAL CUT widget toolkit *
* *
* Copyright 2019-2020 Markus Gans *
* Copyright 2019-2021 Markus Gans *
* *
* FINAL CUT is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as *
@ -47,7 +47,7 @@ class ConEmu
{
public:
// Enumeration
enum console
enum class console
{
ansi,
xterm,
@ -69,7 +69,8 @@ class ConEmu
screen,
tmux,
kterm,
mlterm
mlterm,
kitty
};
// Constructors
@ -651,10 +652,11 @@ inline const char* ConEmu::getAnswerback (console con)
0, // screen
0, // tmux
0, // kterm,
0 // mlterm - Multi Lingual TERMinal
0, // mlterm - Multi Lingual TERMinal
0 // kitty
};
return Answerback[con];
return Answerback[static_cast<std::size_t>(con)];
}
//----------------------------------------------------------------------
@ -682,10 +684,11 @@ inline const char* ConEmu::getDSR (console con)
C_STR("\033[0n"), // screen
C_STR("\033[0n"), // tmux
C_STR("\033[0n"), // kterm
C_STR("\033[0n") // mlterm - Multi Lingual TERMinal
C_STR("\033[0n"), // mlterm - Multi Lingual TERMinal
C_STR("\033[0n") // kitty
};
return DSR[con];
return DSR[static_cast<std::size_t>(con)];
}
//----------------------------------------------------------------------
@ -713,10 +716,11 @@ inline const char* ConEmu::getDECID (console con)
C_STR("\033[?1;2c"), // screen
0, // tmux
C_STR("\033[?1;2c"), // kterm
C_STR("\033[?63;1;2;3;4;7;29c") // mlterm - Multi Lingual TERMinal
C_STR("\033[?63;1;2;3;4;7;29c"), // mlterm - Multi Lingual TERMinal
0 // kitty
};
return DECID[con];
return DECID[static_cast<std::size_t>(con)];
}
//----------------------------------------------------------------------
@ -744,10 +748,11 @@ inline const char* ConEmu::getDA (console con)
C_STR("\033[?1;2c"), // screen
C_STR("\033[?1;2c"), // tmux
C_STR("\033[?1;2c"), // kterm
C_STR("\033[?63;1;2;3;4;7;29c") // mlterm - Multi Lingual TERMinal
C_STR("\033[?63;1;2;3;4;7;29c"), // mlterm - Multi Lingual TERMinal
C_STR("\033[?62;c") // kitty
};
return DA[con];
return DA[static_cast<std::size_t>(con)];
}
//----------------------------------------------------------------------
@ -775,10 +780,11 @@ inline const char* ConEmu::getDA1 (console con)
0, // screen
0, // tmux
0, // kterm
C_STR("\033[?63;1;2;3;4;7;29c") // mlterm - Multi Lingual TERMinal
C_STR("\033[?63;1;2;3;4;7;29c"), // mlterm - Multi Lingual TERMinal
0 // kitty
};
return DA1[con];
return DA1[static_cast<std::size_t>(con)];
}
//----------------------------------------------------------------------
@ -806,10 +812,11 @@ inline const char* ConEmu::getSEC_DA (console con)
C_STR("\033[>83;40201;0c"), // screen
C_STR("\033[>84;0;0c"), // tmux
C_STR("\033[?1;2c"), // kterm
C_STR("\033[>24;279;0c") // mlterm - Multi Lingual TERMinal
C_STR("\033[>24;279;0c"), // mlterm - Multi Lingual TERMinal
C_STR("\033[>1;4000;13c") // kitty
};
return SEC_DA[con];
return SEC_DA[static_cast<std::size_t>(con)];
}
//----------------------------------------------------------------------
@ -967,26 +974,27 @@ inline void ConEmu::parseTerminalBuffer (std::size_t length, console con)
&& buffer[i + 3] == '1'
&& buffer[i + 4] == 't' )
{
if ( con == urxvt )
if ( con == console::urxvt )
write (fd_master, "\033]l", 3);
else if ( con == tera_term )
else if ( con == console::tera_term )
write (fd_master, "\033]l\033\\", 5);
else if ( con == screen )
else if ( con == console::screen )
write (fd_master, "\033]lbash\033\\", 9);
else if ( con != ansi
&& con != rxvt
&& con != kde_konsole
&& con != cygwin
&& con != win_terminal
&& con != mintty
&& con != linux_con
&& con != freebsd_con
&& con != netbsd_con
&& con != openbsd_con
&& con != sun_con
&& con != tmux
&& con != kterm
&& con != mlterm )
else if ( con != console::ansi
&& con != console::rxvt
&& con != console::kde_konsole
&& con != console::cygwin
&& con != console::win_terminal
&& con != console::mintty
&& con != console::linux_con
&& con != console::freebsd_con
&& con != console::netbsd_con
&& con != console::openbsd_con
&& con != console::sun_con
&& con != console::tmux
&& con != console::kterm
&& con != console::mlterm
&& con != console::kitty )
write (fd_master, "\033]lTITLE\033\\", 10);
i += 5;
@ -1001,20 +1009,20 @@ inline void ConEmu::parseTerminalBuffer (std::size_t length, console con)
&& buffer[i + 6] == '?'
&& buffer[i + 7] == '\a' )
{
if ( con != ansi
&& con != rxvt
&& con != kde_konsole
&& con != cygwin
&& con != win_terminal
&& con != mintty
&& con != linux_con
&& con != freebsd_con
&& con != netbsd_con
&& con != openbsd_con
&& con != sun_con
&& con != screen
&& con != tmux
&& con != kterm )
if ( con != console::ansi
&& con != console::rxvt
&& con != console::kde_konsole
&& con != console::cygwin
&& con != console::win_terminal
&& con != console::mintty
&& con != console::linux_con
&& con != console::freebsd_con
&& con != console::netbsd_con
&& con != console::openbsd_con
&& con != console::sun_con
&& con != console::screen
&& con != console::tmux
&& con != console::kterm )
{
int n = buffer[i + 4] - '0';
write (fd_master, "\033]4;", 4);
@ -1037,20 +1045,20 @@ inline void ConEmu::parseTerminalBuffer (std::size_t length, console con)
&& buffer[i + 7] == '?'
&& buffer[i + 8] == '\a' )
{
if ( con != ansi
&& con != rxvt
&& con != kde_konsole
&& con != cygwin
&& con != win_terminal
&& con != mintty
&& con != linux_con
&& con != freebsd_con
&& con != netbsd_con
&& con != openbsd_con
&& con != sun_con
&& con != screen
&& con != tmux
&& con != kterm )
if ( con != console::ansi
&& con != console::rxvt
&& con != console::kde_konsole
&& con != console::cygwin
&& con != console::win_terminal
&& con != console::mintty
&& con != console::linux_con
&& con != console::freebsd_con
&& con != console::netbsd_con
&& con != console::openbsd_con
&& con != console::sun_con
&& con != console::screen
&& con != console::tmux
&& con != console::kterm )
{
int n = (buffer[i + 4] - '0') * 10
+ (buffer[i + 5] - '0');
@ -1076,20 +1084,20 @@ inline void ConEmu::parseTerminalBuffer (std::size_t length, console con)
&& buffer[i + 8] == '?'
&& buffer[i + 9] == '\a' )
{
if ( con != ansi
&& con != rxvt
&& con != kde_konsole
&& con != cygwin
&& con != win_terminal
&& con != mintty
&& con != linux_con
&& con != freebsd_con
&& con != netbsd_con
&& con != openbsd_con
&& con != sun_con
&& con != screen
&& con != tmux
&& con != kterm )
if ( con != console::ansi
&& con != console::rxvt
&& con != console::kde_konsole
&& con != console::cygwin
&& con != console::win_terminal
&& con != console::mintty
&& con != console::linux_con
&& con != console::freebsd_con
&& con != console::netbsd_con
&& con != console::openbsd_con
&& con != console::sun_con
&& con != console::screen
&& con != console::tmux
&& con != console::kterm )
{
int n = (buffer[i + 4] - '0') * 100
+ (buffer[i + 5] - '0') * 10

View File

@ -2561,7 +2561,7 @@ void FTermFunctionsTest::readCursorPosTest()
else // Parent
{
// Start the terminal emulation
startConEmuTerminal (ConEmu::xterm);
startConEmuTerminal (ConEmu::console::xterm);
if ( waitpid(pid, 0, WUNTRACED) != pid )
std::cerr << "waitpid error" << std::endl;

View File

@ -3,7 +3,7 @@
* *
* This file is part of the FINAL CUT widget toolkit *
* *
* Copyright 2018-2020 Markus Gans *
* Copyright 2018-2021 Markus Gans *
* *
* FINAL CUT is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as *
@ -172,6 +172,7 @@ class FTermcapQuirksTest : public CPPUNIT_NS::TestFixture
void linuxTest();
void rxvtTest();
void vteTest();
void kittyTest();
void puttyTest();
void teratermTest();
void sunTest();
@ -194,6 +195,7 @@ class FTermcapQuirksTest : public CPPUNIT_NS::TestFixture
CPPUNIT_TEST (linuxTest);
CPPUNIT_TEST (rxvtTest);
CPPUNIT_TEST (vteTest);
CPPUNIT_TEST (kittyTest);
CPPUNIT_TEST (puttyTest);
CPPUNIT_TEST (teratermTest);
CPPUNIT_TEST (sunTest);
@ -513,6 +515,31 @@ void FTermcapQuirksTest::vteTest()
detect.setGnomeTerminal (false);
}
//----------------------------------------------------------------------
void FTermcapQuirksTest::kittyTest()
{
auto& caps = finalcut::FTermcap::strings;
constexpr int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
for (std::size_t i = 0; i < last_item; i++)
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
caps[int(finalcut::Termcap::t_enter_ca_mode)].string = CSI "?1049h";
caps[int(finalcut::Termcap::t_exit_ca_mode)].string = CSI "?1049l";
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection& detect = *finalcut::FTerm::getFTermDetection();
finalcut::FTermcapQuirks quirks;
detect.setKittyTerminal (true);
data.setTermType ("xterm-kitty");
quirks.terminalFixup();
CPPUNIT_ASSERT_CSTRING ( caps[int(finalcut::Termcap::t_enter_ca_mode)].string
, CSI "?1049h" CSI "22;0;0t" );
CPPUNIT_ASSERT_CSTRING ( caps[int(finalcut::Termcap::t_exit_ca_mode)].string
, CSI "?1049l" CSI "23;0;0t" );
detect.setKittyTerminal (false);
}
//----------------------------------------------------------------------
void FTermcapQuirksTest::puttyTest()

View File

@ -3,7 +3,7 @@
* *
* This file is part of the FINAL CUT widget toolkit *
* *
* Copyright 2018-2020 Markus Gans *
* Copyright 2018-2021 Markus Gans *
* *
* FINAL CUT is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as *
@ -85,6 +85,7 @@ class FTermDetectionTest : public CPPUNIT_NS::TestFixture, test::ConEmu
void tmuxTest();
void ktermTest();
void mltermTest();
void kittyTest();
void ttytypeTest();
private:
@ -114,6 +115,7 @@ class FTermDetectionTest : public CPPUNIT_NS::TestFixture, test::ConEmu
CPPUNIT_TEST (tmuxTest);
CPPUNIT_TEST (ktermTest);
CPPUNIT_TEST (mltermTest);
CPPUNIT_TEST (kittyTest);
CPPUNIT_TEST (ttytypeTest);
// End of test suite definition
@ -158,6 +160,7 @@ void FTermDetectionTest::ansiTest()
unsetenv("KONSOLE_DBUS_SESSION");
unsetenv("KONSOLE_DCOP");
unsetenv("TMUX");
unsetenv("KITTY_WINDOW_ID");
detect.detect();
CPPUNIT_ASSERT ( ! detect.isXTerminal() );
@ -180,6 +183,7 @@ void FTermDetectionTest::ansiTest()
CPPUNIT_ASSERT ( ! detect.isTmuxTerm() );
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
CPPUNIT_ASSERT ( ! detect.isKittyTerminal() );
CPPUNIT_ASSERT ( ! detect.canDisplay256Colors() );
CPPUNIT_ASSERT ( ! detect.hasTerminalDetection() );
CPPUNIT_ASSERT ( ! detect.hasSetCursorStyleSupport() );
@ -199,7 +203,7 @@ void FTermDetectionTest::ansiTest()
else // Parent
{
// Start the terminal emulation
startConEmuTerminal (ConEmu::ansi);
startConEmuTerminal (ConEmu::console::ansi);
if ( waitpid(pid, 0, WUNTRACED) != pid )
std::cerr << "waitpid error" << std::endl;
@ -228,6 +232,7 @@ void FTermDetectionTest::xtermTest()
unsetenv("KONSOLE_DBUS_SESSION");
unsetenv("KONSOLE_DCOP");
unsetenv("TMUX");
unsetenv("KITTY_WINDOW_ID");
detect.detect();
CPPUNIT_ASSERT ( detect.isXTerminal() );
@ -250,6 +255,7 @@ void FTermDetectionTest::xtermTest()
CPPUNIT_ASSERT ( ! detect.isTmuxTerm() );
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
CPPUNIT_ASSERT ( ! detect.isKittyTerminal() );
CPPUNIT_ASSERT ( detect.canDisplay256Colors() );
CPPUNIT_ASSERT ( detect.hasTerminalDetection() );
CPPUNIT_ASSERT ( detect.hasSetCursorStyleSupport() );
@ -261,7 +267,7 @@ void FTermDetectionTest::xtermTest()
else // Parent
{
// Start the terminal emulation
startConEmuTerminal (ConEmu::xterm);
startConEmuTerminal (ConEmu::console::xterm);
if ( waitpid(pid, 0, WUNTRACED) != pid )
std::cerr << "waitpid error" << std::endl;
@ -290,6 +296,7 @@ void FTermDetectionTest::rxvtTest()
unsetenv("KONSOLE_DBUS_SESSION");
unsetenv("KONSOLE_DCOP");
unsetenv("TMUX");
unsetenv("KITTY_WINDOW_ID");
detect.detect();
CPPUNIT_ASSERT ( ! detect.isXTerminal() );
@ -312,6 +319,7 @@ void FTermDetectionTest::rxvtTest()
CPPUNIT_ASSERT ( ! detect.isTmuxTerm() );
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
CPPUNIT_ASSERT ( ! detect.isKittyTerminal() );
CPPUNIT_ASSERT ( detect.canDisplay256Colors() );
CPPUNIT_ASSERT ( detect.hasTerminalDetection() );
CPPUNIT_ASSERT ( ! detect.hasSetCursorStyleSupport() );
@ -324,7 +332,7 @@ void FTermDetectionTest::rxvtTest()
else // Parent
{
// Start the terminal emulation
startConEmuTerminal (ConEmu::rxvt);
startConEmuTerminal (ConEmu::console::rxvt);
if ( waitpid(pid, 0, WUNTRACED) != pid )
std::cerr << "waitpid error" << std::endl;
@ -353,6 +361,7 @@ void FTermDetectionTest::urxvtTest()
unsetenv("KONSOLE_DBUS_SESSION");
unsetenv("KONSOLE_DCOP");
unsetenv("TMUX");
unsetenv("KITTY_WINDOW_ID");
detect.detect();
CPPUNIT_ASSERT ( ! detect.isXTerminal() );
@ -375,6 +384,7 @@ void FTermDetectionTest::urxvtTest()
CPPUNIT_ASSERT ( ! detect.isTmuxTerm() );
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
CPPUNIT_ASSERT ( ! detect.isKittyTerminal() );
CPPUNIT_ASSERT ( detect.canDisplay256Colors() );
CPPUNIT_ASSERT ( detect.hasTerminalDetection() );
CPPUNIT_ASSERT ( ! detect.hasSetCursorStyleSupport() );
@ -386,7 +396,7 @@ void FTermDetectionTest::urxvtTest()
else // Parent
{
// Start the terminal emulation
startConEmuTerminal (ConEmu::urxvt);
startConEmuTerminal (ConEmu::console::urxvt);
if ( waitpid(pid, 0, WUNTRACED) != pid )
std::cerr << "waitpid error" << std::endl;
@ -415,6 +425,7 @@ void FTermDetectionTest::kdeKonsoleTest()
unsetenv("XTERM_VERSION");
unsetenv("ROXTERM_ID");
unsetenv("TMUX");
unsetenv("KITTY_WINDOW_ID");
detect.detect();
CPPUNIT_ASSERT ( detect.isXTerminal() );
@ -437,6 +448,7 @@ void FTermDetectionTest::kdeKonsoleTest()
CPPUNIT_ASSERT ( ! detect.isTmuxTerm() );
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
CPPUNIT_ASSERT ( ! detect.isKittyTerminal() );
CPPUNIT_ASSERT ( detect.canDisplay256Colors() );
CPPUNIT_ASSERT ( detect.hasTerminalDetection() );
CPPUNIT_ASSERT ( ! detect.hasSetCursorStyleSupport() );
@ -448,7 +460,7 @@ void FTermDetectionTest::kdeKonsoleTest()
else // Parent
{
// Start the terminal emulation
startConEmuTerminal (ConEmu::kde_konsole);
startConEmuTerminal (ConEmu::console::kde_konsole);
if ( waitpid(pid, 0, WUNTRACED) != pid )
std::cerr << "waitpid error" << std::endl;
@ -477,7 +489,7 @@ void FTermDetectionTest::gnomeTerminalTest()
unsetenv("KONSOLE_DBUS_SESSION");
unsetenv("KONSOLE_DCOP");
unsetenv("TMUX");
unsetenv("KITTY_WINDOW_ID");
detect.detect();
CPPUNIT_ASSERT ( detect.isXTerminal() );
@ -500,6 +512,7 @@ void FTermDetectionTest::gnomeTerminalTest()
CPPUNIT_ASSERT ( ! detect.isTmuxTerm() );
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
CPPUNIT_ASSERT ( ! detect.isKittyTerminal() );
CPPUNIT_ASSERT ( detect.canDisplay256Colors() );
CPPUNIT_ASSERT ( detect.hasTerminalDetection() );
CPPUNIT_ASSERT ( detect.hasSetCursorStyleSupport() );
@ -511,7 +524,7 @@ void FTermDetectionTest::gnomeTerminalTest()
else // Parent
{
// Start the terminal emulation
startConEmuTerminal (ConEmu::gnome_terminal);
startConEmuTerminal (ConEmu::console::gnome_terminal);
if ( waitpid(pid, 0, WUNTRACED) != pid )
std::cerr << "waitpid error" << std::endl;
@ -540,7 +553,7 @@ void FTermDetectionTest::newerVteTerminalTest()
unsetenv("KONSOLE_DBUS_SESSION");
unsetenv("KONSOLE_DCOP");
unsetenv("TMUX");
unsetenv("KITTY_WINDOW_ID");
detect.detect();
CPPUNIT_ASSERT ( detect.isXTerminal() );
@ -563,6 +576,7 @@ void FTermDetectionTest::newerVteTerminalTest()
CPPUNIT_ASSERT ( ! detect.isTmuxTerm() );
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
CPPUNIT_ASSERT ( ! detect.isKittyTerminal() );
CPPUNIT_ASSERT ( detect.canDisplay256Colors() );
CPPUNIT_ASSERT ( detect.hasTerminalDetection() );
CPPUNIT_ASSERT ( detect.hasSetCursorStyleSupport() );
@ -574,7 +588,7 @@ void FTermDetectionTest::newerVteTerminalTest()
else // Parent
{
// Start the terminal emulation
startConEmuTerminal (ConEmu::newer_vte_terminal);
startConEmuTerminal (ConEmu::console::newer_vte_terminal);
if ( waitpid(pid, 0, WUNTRACED) != pid )
std::cerr << "waitpid error" << std::endl;
@ -603,6 +617,7 @@ void FTermDetectionTest::puttyTest()
unsetenv("KONSOLE_DBUS_SESSION");
unsetenv("KONSOLE_DCOP");
unsetenv("TMUX");
unsetenv("KITTY_WINDOW_ID");
detect.detect();
CPPUNIT_ASSERT ( detect.isXTerminal() );
@ -625,6 +640,7 @@ void FTermDetectionTest::puttyTest()
CPPUNIT_ASSERT ( ! detect.isTmuxTerm() );
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
CPPUNIT_ASSERT ( ! detect.isKittyTerminal() );
CPPUNIT_ASSERT ( detect.canDisplay256Colors() );
CPPUNIT_ASSERT ( detect.hasTerminalDetection() );
CPPUNIT_ASSERT ( ! detect.hasSetCursorStyleSupport() );
@ -637,7 +653,7 @@ void FTermDetectionTest::puttyTest()
else // Parent
{
// Start the terminal emulation
startConEmuTerminal (ConEmu::putty);
startConEmuTerminal (ConEmu::console::putty);
if ( waitpid(pid, 0, WUNTRACED) != pid )
std::cerr << "waitpid error" << std::endl;
@ -666,6 +682,7 @@ void FTermDetectionTest::windowsTerminalTest()
unsetenv("KONSOLE_DBUS_SESSION");
unsetenv("KONSOLE_DCOP");
unsetenv("TMUX");
unsetenv("KITTY_WINDOW_ID");
setenv ("WT_PROFILE_ID", "{61c54cbd-c2a6-5271-96e7-009a87ff44bf}", 1);
setenv ("WT_SESSION", "4dc413a1-5ed9-46d4-b4e0-5a2fec7acb44", 1);
detect.detect();
@ -690,6 +707,7 @@ void FTermDetectionTest::windowsTerminalTest()
CPPUNIT_ASSERT ( ! detect.isTmuxTerm() );
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
CPPUNIT_ASSERT ( ! detect.isKittyTerminal() );
CPPUNIT_ASSERT ( detect.canDisplay256Colors() );
CPPUNIT_ASSERT ( detect.hasTerminalDetection() );
CPPUNIT_ASSERT ( ! detect.hasSetCursorStyleSupport() );
@ -701,7 +719,7 @@ void FTermDetectionTest::windowsTerminalTest()
else // Parent
{
// Start the terminal emulation
startConEmuTerminal (ConEmu::win_terminal);
startConEmuTerminal (ConEmu::console::win_terminal);
if ( waitpid(pid, 0, WUNTRACED) != pid )
std::cerr << "waitpid error" << std::endl;
@ -730,7 +748,7 @@ void FTermDetectionTest::teraTermTest()
unsetenv("KONSOLE_DBUS_SESSION");
unsetenv("KONSOLE_DCOP");
unsetenv("TMUX");
unsetenv("KITTY_WINDOW_ID");
detect.detect();
CPPUNIT_ASSERT ( detect.isXTerminal() );
@ -753,6 +771,7 @@ void FTermDetectionTest::teraTermTest()
CPPUNIT_ASSERT ( ! detect.isTmuxTerm() );
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
CPPUNIT_ASSERT ( ! detect.isKittyTerminal() );
CPPUNIT_ASSERT ( ! detect.canDisplay256Colors() );
CPPUNIT_ASSERT ( detect.hasTerminalDetection() );
CPPUNIT_ASSERT ( ! detect.hasSetCursorStyleSupport() );
@ -764,7 +783,7 @@ void FTermDetectionTest::teraTermTest()
else // Parent
{
// Start the terminal emulation
startConEmuTerminal (ConEmu::tera_term);
startConEmuTerminal (ConEmu::console::tera_term);
if ( waitpid(pid, 0, WUNTRACED) != pid )
std::cerr << "waitpid error" << std::endl;
@ -793,7 +812,7 @@ void FTermDetectionTest::cygwinTest()
unsetenv("KONSOLE_DBUS_SESSION");
unsetenv("KONSOLE_DCOP");
unsetenv("TMUX");
unsetenv("KITTY_WINDOW_ID");
detect.detect();
CPPUNIT_ASSERT ( ! detect.isXTerminal() );
@ -816,6 +835,7 @@ void FTermDetectionTest::cygwinTest()
CPPUNIT_ASSERT ( ! detect.isTmuxTerm() );
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
CPPUNIT_ASSERT ( ! detect.isKittyTerminal() );
CPPUNIT_ASSERT ( ! detect.canDisplay256Colors() );
CPPUNIT_ASSERT ( detect.hasTerminalDetection() );
CPPUNIT_ASSERT ( ! detect.hasSetCursorStyleSupport() );
@ -827,7 +847,7 @@ void FTermDetectionTest::cygwinTest()
else // Parent
{
// Start the terminal emulation
startConEmuTerminal (ConEmu::cygwin);
startConEmuTerminal (ConEmu::console::cygwin);
if ( waitpid(pid, 0, WUNTRACED) != pid )
std::cerr << "waitpid error" << std::endl;
@ -856,7 +876,7 @@ void FTermDetectionTest::minttyTest()
unsetenv("KONSOLE_DBUS_SESSION");
unsetenv("KONSOLE_DCOP");
unsetenv("TMUX");
unsetenv("KITTY_WINDOW_ID");
detect.detect();
CPPUNIT_ASSERT ( detect.isXTerminal() );
@ -879,6 +899,7 @@ void FTermDetectionTest::minttyTest()
CPPUNIT_ASSERT ( ! detect.isTmuxTerm() );
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
CPPUNIT_ASSERT ( ! detect.isKittyTerminal() );
CPPUNIT_ASSERT ( detect.canDisplay256Colors() );
CPPUNIT_ASSERT ( detect.hasTerminalDetection() );
CPPUNIT_ASSERT ( detect.hasSetCursorStyleSupport() );
@ -890,7 +911,7 @@ void FTermDetectionTest::minttyTest()
else // Parent
{
// Start the terminal emulation
startConEmuTerminal (ConEmu::mintty);
startConEmuTerminal (ConEmu::console::mintty);
if ( waitpid(pid, 0, WUNTRACED) != pid )
std::cerr << "waitpid error" << std::endl;
@ -919,7 +940,7 @@ void FTermDetectionTest::linuxTest()
unsetenv("KONSOLE_DBUS_SESSION");
unsetenv("KONSOLE_DCOP");
unsetenv("TMUX");
unsetenv("KITTY_WINDOW_ID");
detect.detect();
CPPUNIT_ASSERT ( ! detect.isXTerminal() );
@ -942,6 +963,7 @@ void FTermDetectionTest::linuxTest()
CPPUNIT_ASSERT ( ! detect.isTmuxTerm() );
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
CPPUNIT_ASSERT ( ! detect.isKittyTerminal() );
CPPUNIT_ASSERT ( ! detect.canDisplay256Colors() );
CPPUNIT_ASSERT ( detect.hasTerminalDetection() );
CPPUNIT_ASSERT ( ! detect.hasSetCursorStyleSupport() );
@ -960,7 +982,7 @@ void FTermDetectionTest::linuxTest()
else // Parent
{
// Start the terminal emulation
startConEmuTerminal (ConEmu::linux_con);
startConEmuTerminal (ConEmu::console::linux_con);
if ( waitpid(pid, 0, WUNTRACED) != pid )
std::cerr << "waitpid error" << std::endl;
@ -989,7 +1011,7 @@ void FTermDetectionTest::freebsdTest()
unsetenv("KONSOLE_DBUS_SESSION");
unsetenv("KONSOLE_DCOP");
unsetenv("TMUX");
unsetenv("KITTY_WINDOW_ID");
detect.detect();
detect.setFreeBSDTerm (true); // Fake FreeBSD Console detection
@ -1013,6 +1035,7 @@ void FTermDetectionTest::freebsdTest()
CPPUNIT_ASSERT ( ! detect.isTmuxTerm() );
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
CPPUNIT_ASSERT ( ! detect.isKittyTerminal() );
CPPUNIT_ASSERT ( ! detect.canDisplay256Colors() );
CPPUNIT_ASSERT ( detect.hasTerminalDetection() );
CPPUNIT_ASSERT ( ! detect.hasSetCursorStyleSupport() );
@ -1033,7 +1056,7 @@ void FTermDetectionTest::freebsdTest()
else // Parent
{
// Start the terminal emulation
startConEmuTerminal (ConEmu::freebsd_con);
startConEmuTerminal (ConEmu::console::freebsd_con);
if ( waitpid(pid, 0, WUNTRACED) != pid )
std::cerr << "waitpid error" << std::endl;
@ -1062,7 +1085,7 @@ void FTermDetectionTest::netbsdTest()
unsetenv("KONSOLE_DBUS_SESSION");
unsetenv("KONSOLE_DCOP");
unsetenv("TMUX");
unsetenv("KITTY_WINDOW_ID");
detect.detect();
detect.setNetBSDTerm (true); // Fake NetBSD Console detection
@ -1086,6 +1109,7 @@ void FTermDetectionTest::netbsdTest()
CPPUNIT_ASSERT ( ! detect.isTmuxTerm() );
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
CPPUNIT_ASSERT ( ! detect.isKittyTerminal() );
CPPUNIT_ASSERT ( ! detect.canDisplay256Colors() );
CPPUNIT_ASSERT ( detect.hasTerminalDetection() );
CPPUNIT_ASSERT ( ! detect.hasSetCursorStyleSupport() );
@ -1104,7 +1128,7 @@ void FTermDetectionTest::netbsdTest()
else // Parent
{
// Start the terminal emulation
startConEmuTerminal (ConEmu::netbsd_con);
startConEmuTerminal (ConEmu::console::netbsd_con);
if ( waitpid(pid, 0, WUNTRACED) != pid )
std::cerr << "waitpid error" << std::endl;
@ -1133,7 +1157,7 @@ void FTermDetectionTest::openbsdTest()
unsetenv("KONSOLE_DBUS_SESSION");
unsetenv("KONSOLE_DCOP");
unsetenv("TMUX");
unsetenv("KITTY_WINDOW_ID");
detect.detect();
detect.setOpenBSDTerm (true); // Fake OpenBSD Console detection
@ -1157,6 +1181,7 @@ void FTermDetectionTest::openbsdTest()
CPPUNIT_ASSERT ( ! detect.isTmuxTerm() );
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
CPPUNIT_ASSERT ( ! detect.isKittyTerminal() );
CPPUNIT_ASSERT ( ! detect.canDisplay256Colors() );
CPPUNIT_ASSERT ( detect.hasTerminalDetection() );
CPPUNIT_ASSERT ( ! detect.hasSetCursorStyleSupport() );
@ -1175,7 +1200,7 @@ void FTermDetectionTest::openbsdTest()
else // Parent
{
// Start the terminal emulation
startConEmuTerminal (ConEmu::openbsd_con);
startConEmuTerminal (ConEmu::console::openbsd_con);
if ( waitpid(pid, 0, WUNTRACED) != pid )
std::cerr << "waitpid error" << std::endl;
@ -1203,7 +1228,7 @@ void FTermDetectionTest::sunTest()
unsetenv("KONSOLE_DBUS_SESSION");
unsetenv("KONSOLE_DCOP");
unsetenv("TMUX");
unsetenv("KITTY_WINDOW_ID");
detect.detect();
CPPUNIT_ASSERT ( ! detect.isXTerminal() );
@ -1226,6 +1251,7 @@ void FTermDetectionTest::sunTest()
CPPUNIT_ASSERT ( ! detect.isTmuxTerm() );
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
CPPUNIT_ASSERT ( ! detect.isKittyTerminal() );
CPPUNIT_ASSERT ( ! detect.canDisplay256Colors() );
CPPUNIT_ASSERT ( ! detect.hasTerminalDetection() );
CPPUNIT_ASSERT ( ! detect.hasSetCursorStyleSupport() );
@ -1244,7 +1270,7 @@ void FTermDetectionTest::sunTest()
else // Parent
{
// Start the terminal emulation
startConEmuTerminal (ConEmu::sun_con);
startConEmuTerminal (ConEmu::console::sun_con);
if ( waitpid(pid, 0, WUNTRACED) != pid )
std::cerr << "waitpid error" << std::endl;
@ -1273,7 +1299,7 @@ void FTermDetectionTest::screenTest()
unsetenv("KONSOLE_DBUS_SESSION");
unsetenv("KONSOLE_DCOP");
unsetenv("TMUX");
unsetenv("KITTY_WINDOW_ID");
detect.detect();
CPPUNIT_ASSERT ( ! detect.isXTerminal() );
@ -1296,6 +1322,7 @@ void FTermDetectionTest::screenTest()
CPPUNIT_ASSERT ( ! detect.isTmuxTerm() );
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
CPPUNIT_ASSERT ( ! detect.isKittyTerminal() );
CPPUNIT_ASSERT ( ! detect.canDisplay256Colors() );
CPPUNIT_ASSERT ( detect.hasTerminalDetection() );
CPPUNIT_ASSERT ( ! detect.hasSetCursorStyleSupport() );
@ -1313,7 +1340,7 @@ void FTermDetectionTest::screenTest()
else // Parent
{
// Start the terminal emulation
startConEmuTerminal (ConEmu::screen);
startConEmuTerminal (ConEmu::console::screen);
if ( waitpid(pid, 0, WUNTRACED) != pid )
std::cerr << "waitpid error" << std::endl;
@ -1343,7 +1370,7 @@ void FTermDetectionTest::tmuxTest()
unsetenv("ROXTERM_ID");
unsetenv("KONSOLE_DBUS_SESSION");
unsetenv("KONSOLE_DCOP");
unsetenv("KITTY_WINDOW_ID");
detect.detect();
CPPUNIT_ASSERT ( ! detect.isXTerminal() );
@ -1366,6 +1393,7 @@ void FTermDetectionTest::tmuxTest()
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT ( detect.isTmuxTerm() );
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
CPPUNIT_ASSERT ( ! detect.isKittyTerminal() );
CPPUNIT_ASSERT ( ! detect.canDisplay256Colors() );
CPPUNIT_ASSERT ( detect.hasTerminalDetection() );
CPPUNIT_ASSERT ( ! detect.hasSetCursorStyleSupport() );
@ -1383,7 +1411,7 @@ void FTermDetectionTest::tmuxTest()
else // Parent
{
// Start the terminal simulation
startConEmuTerminal (ConEmu::tmux);
startConEmuTerminal (ConEmu::console::tmux);
if ( waitpid(pid, 0, WUNTRACED) != pid )
std::cerr << "waitpid error" << std::endl;
@ -1412,7 +1440,7 @@ void FTermDetectionTest::ktermTest()
unsetenv("KONSOLE_DBUS_SESSION");
unsetenv("KONSOLE_DCOP");
unsetenv("TMUX");
unsetenv("KITTY_WINDOW_ID");
detect.detect();
CPPUNIT_ASSERT ( ! detect.isXTerminal() );
@ -1435,6 +1463,7 @@ void FTermDetectionTest::ktermTest()
CPPUNIT_ASSERT ( ! detect.isTmuxTerm() );
CPPUNIT_ASSERT ( detect.isKtermTerminal() );
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
CPPUNIT_ASSERT ( ! detect.isKittyTerminal() );
CPPUNIT_ASSERT ( ! detect.canDisplay256Colors() );
CPPUNIT_ASSERT ( ! detect.hasTerminalDetection() );
CPPUNIT_ASSERT ( ! detect.hasSetCursorStyleSupport() );
@ -1453,7 +1482,7 @@ void FTermDetectionTest::ktermTest()
else // Parent
{
// Start the terminal emulation
startConEmuTerminal (ConEmu::kterm);
startConEmuTerminal (ConEmu::console::kterm);
if ( waitpid(pid, 0, WUNTRACED) != pid )
std::cerr << "waitpid error" << std::endl;
@ -1483,6 +1512,7 @@ void FTermDetectionTest::mltermTest()
unsetenv("KONSOLE_DBUS_SESSION");
unsetenv("KONSOLE_DCOP");
unsetenv("TMUX");
unsetenv("KITTY_WINDOW_ID");
detect.detect();
CPPUNIT_ASSERT ( ! detect.isXTerminal() );
@ -1505,6 +1535,7 @@ void FTermDetectionTest::mltermTest()
CPPUNIT_ASSERT ( ! detect.isTmuxTerm() );
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT ( detect.isMltermTerminal() );
CPPUNIT_ASSERT ( ! detect.isKittyTerminal() );
CPPUNIT_ASSERT ( detect.canDisplay256Colors() );
CPPUNIT_ASSERT ( detect.hasTerminalDetection() );
CPPUNIT_ASSERT ( ! detect.hasSetCursorStyleSupport() );
@ -1523,7 +1554,75 @@ void FTermDetectionTest::mltermTest()
else // Parent
{
// Start the terminal emulation
startConEmuTerminal (ConEmu::mlterm);
startConEmuTerminal (ConEmu::console::mlterm);
if ( waitpid(pid, 0, WUNTRACED) != pid )
std::cerr << "waitpid error" << std::endl;
}
}
//----------------------------------------------------------------------
void FTermDetectionTest::kittyTest()
{
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect;
data.setTermType("xterm-kitty");
detect.setTerminalDetection(true);
pid_t pid = forkConEmu();
if ( isConEmuChildProcess(pid) )
{
setenv ("TERM", "xterm-kitty", 1);
setenv ("KITTY_WINDOW_ID", "1", 1);
setenv ("COLORTERM", "truecolor", 1);
unsetenv("TERMCAP");
unsetenv("VTE_VERSION");
unsetenv("XTERM_VERSION");
unsetenv("ROXTERM_ID");
unsetenv("KONSOLE_DBUS_SESSION");
unsetenv("KONSOLE_DCOP");
unsetenv("TMUX");
detect.detect();
CPPUNIT_ASSERT ( ! detect.isXTerminal() );
CPPUNIT_ASSERT ( ! detect.isAnsiTerminal() );
CPPUNIT_ASSERT ( ! detect.isRxvtTerminal() );
CPPUNIT_ASSERT ( ! detect.isUrxvtTerminal() );
CPPUNIT_ASSERT ( ! detect.isKdeTerminal() );
CPPUNIT_ASSERT ( ! detect.isGnomeTerminal() );
CPPUNIT_ASSERT ( ! detect.isPuttyTerminal() );
CPPUNIT_ASSERT ( ! detect.isWindowsTerminal() );
CPPUNIT_ASSERT ( ! detect.isTeraTerm() );
CPPUNIT_ASSERT ( ! detect.isCygwinTerminal() );
CPPUNIT_ASSERT ( ! detect.isMinttyTerm() );
CPPUNIT_ASSERT ( ! detect.isLinuxTerm() );
CPPUNIT_ASSERT ( ! detect.isFreeBSDTerm() );
CPPUNIT_ASSERT ( ! detect.isNetBSDTerm() );
CPPUNIT_ASSERT ( ! detect.isOpenBSDTerm() );
CPPUNIT_ASSERT ( ! detect.isSunTerminal() );
CPPUNIT_ASSERT ( ! detect.isScreenTerm() );
CPPUNIT_ASSERT ( ! detect.isTmuxTerm() );
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
CPPUNIT_ASSERT ( detect.isKittyTerminal() );
CPPUNIT_ASSERT ( detect.canDisplay256Colors() );
CPPUNIT_ASSERT ( detect.hasTerminalDetection() );
CPPUNIT_ASSERT ( ! detect.hasSetCursorStyleSupport() );
CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), "xterm-kitty" );
auto kitty_version = detect.getKittyVersion();
CPPUNIT_ASSERT ( kitty_version.primary == 0 );
CPPUNIT_ASSERT ( kitty_version.secondary == 13 );
printConEmuDebug();
closeConEmuStdStreams();
exit(EXIT_SUCCESS);
}
else // Parent
{
// Start the terminal emulation
startConEmuTerminal (ConEmu::console::kitty);
if ( waitpid(pid, 0, WUNTRACED) != pid )
std::cerr << "waitpid error" << std::endl;
@ -1586,6 +1685,7 @@ void FTermDetectionTest::ttytypeTest()
unsetenv("KONSOLE_DBUS_SESSION");
unsetenv("KONSOLE_DCOP");
unsetenv("TMUX");
unsetenv("KITTY_WINDOW_ID");
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
// Test /dev/tty3 with linux
@ -1610,7 +1710,7 @@ void FTermDetectionTest::ttytypeTest()
else // Parent
{
// Start the terminal emulation
startConEmuTerminal (ConEmu::ansi);
startConEmuTerminal (ConEmu::console::ansi);
if ( waitpid(pid, 0, WUNTRACED) != pid )
std::cerr << "waitpid error" << std::endl;

View File

@ -809,7 +809,7 @@ void ftermfreebsdTest::freebsdConsoleTest()
else // Parent
{
// Start the terminal emulation
startConEmuTerminal (ConEmu::freebsd_con);
startConEmuTerminal (ConEmu::console::freebsd_con);
if ( waitpid(pid, 0, WUNTRACED) != pid )
std::cerr << "waitpid error" << std::endl;

View File

@ -1669,7 +1669,7 @@ void FTermLinuxTest::linuxConsoleTest()
else // Parent
{
// Start the terminal emulation
startConEmuTerminal (ConEmu::linux_con);
startConEmuTerminal (ConEmu::console::linux_con);
if ( waitpid(pid, 0, WUNTRACED) != pid )
std::cerr << "waitpid error" << std::endl;
@ -1858,7 +1858,7 @@ void FTermLinuxTest::linuxCursorStyleTest()
else // Parent
{
// Start the terminal emulation
startConEmuTerminal (ConEmu::linux_con);
startConEmuTerminal (ConEmu::console::linux_con);
if ( waitpid(pid, 0, WUNTRACED) != pid )
std::cerr << "waitpid error" << std::endl;
@ -2133,7 +2133,7 @@ void FTermLinuxTest::linuxColorPaletteTest()
else // Parent
{
// Start the terminal emulation
startConEmuTerminal (ConEmu::linux_con);
startConEmuTerminal (ConEmu::console::linux_con);
if ( waitpid(pid, 0, WUNTRACED) != pid )
std::cerr << "waitpid error" << std::endl;
@ -2276,7 +2276,7 @@ void FTermLinuxTest::linuxFontTest()
else // Parent
{
// Start the terminal emulation
startConEmuTerminal (ConEmu::linux_con);
startConEmuTerminal (ConEmu::console::linux_con);
if ( waitpid(pid, 0, WUNTRACED) != pid )
std::cerr << "waitpid error" << std::endl;

View File

@ -435,7 +435,7 @@ void ftermopenbsdTest::netbsdConsoleTest()
else // Parent
{
// Start the terminal emulation
startConEmuTerminal (ConEmu::netbsd_con);
startConEmuTerminal (ConEmu::console::netbsd_con);
if ( waitpid(pid, 0, WUNTRACED) != pid )
std::cerr << "waitpid error" << std::endl;
@ -571,7 +571,7 @@ void ftermopenbsdTest::openbsdConsoleTest()
else // Parent
{
// Start the terminal emulation
startConEmuTerminal (ConEmu::openbsd_con);
startConEmuTerminal (ConEmu::console::openbsd_con);
if ( waitpid(pid, 0, WUNTRACED) != pid )
std::cerr << "waitpid error" << std::endl;