Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ftxui::ScreenInteractive disables raw mode some time after program ends #994

Open
temik-kemper opened this issue Jan 23, 2025 · 0 comments

Comments

@temik-kemper
Copy link

temik-kemper commented Jan 23, 2025

it seems like ftxui::ScreenInteractive disables raw mode only after the program exited, so if mouse was moving on terminal screen i get a few garbage symbols in terminal
same if program stops by SIGINT or by ScreenInteractive.Exit()

minimal working example

#include "ftxui/component/component.hpp"
#include "ftxui/component/screen_interactive.hpp"

int main(){
    auto screen = ftxui::ScreenInteractive::Fullscreen();
    auto testComponent = ftxui::Renderer([](){return ftxui::text("test Component");});
    screen.Loop(testComponent);
    return 0;
}

output(sometimes) :

# ./issue 
# 1;48;10M

program is run on arm processor on embedded linux, to which I'm connecting by ssh using "GNOME Terminal" version 3.44.0 on linux mint
ftxui::ScreenInteractive.TrackMouse(false) doesn't fix it
the only consistent workaround i found is this monstrosity

#include "ftxui/component/component.hpp"
#include "ftxui/component/screen_interactive.hpp"

#include <stdlib.h>
#include <termios.h>
#include <unistd.h>
struct termios orig_termios;

int main(){
    tcgetattr(STDIN_FILENO, &orig_termios);
    { // so screen destructor is called first
        auto screen = ftxui::ScreenInteractive::Fullscreen();
        screen.TrackMouse(false);
        auto testComponent = ftxui::Renderer([](){return ftxui::text("test Component");});
        screen.Loop(testComponent);
    }
    tcsetattr(STDIN_FILENO, TCSAFLUSH, &orig_termios);
    // std::system("clear");
    return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant