mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-09-28 16:29:34 +08:00
Add opt-in piped input support for POSIX systems
Enables applications to read piped data while maintaining interactive keyboard input by redirecting stdin to /dev/tty when explicitly enabled.
This commit is contained in:

committed by
ArthurSonzogni

parent
40e1fac3d4
commit
143b24c6a5
@@ -47,6 +47,7 @@ class ScreenInteractive : public Screen {
|
||||
|
||||
// Options. Must be called before Loop().
|
||||
void TrackMouse(bool enable = true);
|
||||
void HandlePipedInput(bool enable = true);
|
||||
|
||||
// Return the currently active screen, nullptr if none.
|
||||
static ScreenInteractive* Active();
|
||||
@@ -141,6 +142,13 @@ class ScreenInteractive : public Screen {
|
||||
bool force_handle_ctrl_c_ = true;
|
||||
bool force_handle_ctrl_z_ = true;
|
||||
|
||||
#if !defined(_WIN32) && !defined(__EMSCRIPTEN__)
|
||||
// Piped input handling state (POSIX only)
|
||||
bool handle_piped_input_ = false;
|
||||
bool stdin_was_redirected_ = false;
|
||||
int original_stdin_fd_ = -1;
|
||||
#endif
|
||||
|
||||
// The style of the cursor to restore on exit.
|
||||
int cursor_reset_shape_ = 1;
|
||||
|
||||
|
Reference in New Issue
Block a user