diff --git a/CHANGELOG.md b/CHANGELOG.md index d3cefa5..53d128f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,9 @@ current (development) ``` A couple of components are now activated when the mouse is pressed, as opposed to released. +- Feature: Add `ScreenInteractive::FullscreenPrimaryScreen()`. This allows + displaying a fullscreen component on the primary screen, as opposed to the + alternate screen. - Bugfix: `Input` `onchange` was not called on backspace or delete key. Fixed by @chrysante in chrysante in PR #776. diff --git a/include/ftxui/component/screen_interactive.hpp b/include/ftxui/component/screen_interactive.hpp index fd3a629..7629f03 100644 --- a/include/ftxui/component/screen_interactive.hpp +++ b/include/ftxui/component/screen_interactive.hpp @@ -31,6 +31,8 @@ class ScreenInteractive : public Screen { // Constructors: static ScreenInteractive FixedSize(int dimx, int dimy); static ScreenInteractive Fullscreen(); + static ScreenInteractive FullscreenPrimaryScreen(); + static ScreenInteractive FullscreenAlternateScreen(); static ScreenInteractive FitComponent(); static ScreenInteractive TerminalOutput(); diff --git a/src/ftxui/component/screen_interactive.cpp b/src/ftxui/component/screen_interactive.cpp index 3366051..a71ecbf 100644 --- a/src/ftxui/component/screen_interactive.cpp +++ b/src/ftxui/component/screen_interactive.cpp @@ -352,8 +352,34 @@ ScreenInteractive ScreenInteractive::FixedSize(int dimx, int dimy) { }; } +/// @ingroup component +/// Create a ScreenInteractive taking the full terminal size. This is using the +/// alternate screen buffer to avoid messing with the terminal content. +/// @note This is the same as `ScreenInteractive::FullscreenAlternateScreen()` // static ScreenInteractive ScreenInteractive::Fullscreen() { + return FullscreenPrimaryScreen(); +} + +/// @ingroup component +/// Create a ScreenInteractive taking the full terminal size. The primary screen +/// buffer is being used. It means if the terminal is resized, the previous +/// content might mess up with the terminal content. +// static +ScreenInteractive ScreenInteractive::FullscreenPrimaryScreen() { + return { + 0, + 0, + Dimension::Fullscreen, + false, + }; +} + +/// @ingroup component +/// Create a ScreenInteractive taking the full terminal size. This is using the +/// alternate screen buffer to avoid messing with the terminal content. +// static +ScreenInteractive ScreenInteractive::FullscreenAlternateScreen() { return { 0, 0,