mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-12-16 01:48:56 +08:00
Coding style + fix tests
This commit is contained in:
@@ -25,6 +25,8 @@ class Loop;
|
||||
struct Event;
|
||||
|
||||
using Component = std::shared_ptr<ComponentBase>;
|
||||
using TerminalIDUpdateCallback = std::function<void (const TerminalID &)>;
|
||||
|
||||
class ScreenInteractivePrivate;
|
||||
|
||||
/// @brief ScreenInteractive is a `Screen` that can handle events, run a main
|
||||
@@ -75,10 +77,7 @@ class ScreenInteractive : public Screen {
|
||||
|
||||
TerminalID TerminalId() const;
|
||||
|
||||
typedef std::function<void(TerminalID const& terminal_id)> TerminalIDUpdateCallback;
|
||||
|
||||
void OnTerminalIDUpdate(
|
||||
TerminalIDUpdateCallback const& callback);
|
||||
void OnTerminalIDUpdate(const TerminalIDUpdateCallback& callback);
|
||||
|
||||
// Selection API.
|
||||
std::string GetSelection();
|
||||
@@ -164,10 +163,10 @@ class ScreenInteractive : public Screen {
|
||||
std::unique_ptr<Selection> selection_;
|
||||
std::function<void()> selection_on_change_;
|
||||
|
||||
TerminalID m_terminal_id;
|
||||
TerminalID m_terminal_id = TerminalID::Unknown;
|
||||
|
||||
typedef std::list<TerminalIDUpdateCallback> TerminalIDUpdateCallbackContainer;
|
||||
TerminalIDUpdateCallbackContainer m_terminal_id_update_callbacks;
|
||||
using TerminalIDUpdateCallbackContainer = std::list<TerminalIDUpdateCallback>;
|
||||
TerminalIDUpdateCallbackContainer terminal_id_callback_;
|
||||
|
||||
friend class Loop;
|
||||
|
||||
|
||||
@@ -10,20 +10,20 @@
|
||||
|
||||
namespace ftxui {
|
||||
|
||||
std::string const TERMINAL_ID_REQUEST("\x1b[0c");
|
||||
|
||||
/// @brief A mouse event. It contains the coordinate of the mouse, the button
|
||||
/// pressed and the modifier (shift, ctrl, meta).
|
||||
/// @brief The TerminalID enum class represents different types of terminal
|
||||
/// emulators that FTXUI can detect. It is used to identify the terminal
|
||||
/// emulator in use, which can affect how FTXUI renders its output and handles
|
||||
/// input events.
|
||||
/// @ingroup component
|
||||
enum class TerminalID {
|
||||
Unknown,
|
||||
// --
|
||||
|
||||
enum class TerminalID
|
||||
{
|
||||
UNKNOWN,
|
||||
XTERM,
|
||||
KONSOLE,
|
||||
URXVT,
|
||||
VTE,
|
||||
LINUXVC
|
||||
Konsole,
|
||||
LinuxVC,
|
||||
Urxvt,
|
||||
Vte,
|
||||
Xterm,
|
||||
};
|
||||
|
||||
std::ostream& operator<<(
|
||||
|
||||
Reference in New Issue
Block a user