This github project demonstrates an issue I've discovered with suspending and halting in Brick.
I modified Brick's demo program brick-suspend-resume-demo to use the /dev/tty handle directly as the configured inputFd:
-- void $ defaultMain theApp initialState
ttyHandle <- openFile "/dev/tty" ReadMode
ttyFd <- IO.handleToFd ttyHandle
defConfig <- V.standardIOConfig
let builder = V.mkVty $ defConfig {
V.inputFd = Just ttyFd
}
initialVty <- builder
void $ customMain initialVty builder Nothing theApp initialState
The reason I wanted to do this was so I can use data piped from STDIN into a Brick program. Because the inputFd is assigned to stdin by default, I need it to be assigned explicitly to /dev/tty in order to make the terminal UI interactive.
If you compile and run my demo executable in the Ubuntu Terminal (tested on Ubuntu 20.04), pressing SPACE once suspends and pressing ESC once quits -- just like the original demo.
If you run the executable in the MacOS Terminal (macOS Montery, Apple M1 Pro), pressing SPACE or ESC once isn't sufficient. You need to press another key afterward to make the suspend or quit command register. Is this bug, or is there something wrong with my Haskell code?
This github project demonstrates an issue I've discovered with suspending and halting in Brick.
I modified Brick's demo program brick-suspend-resume-demo to use the
/dev/ttyhandle directly as the configuredinputFd:The reason I wanted to do this was so I can use data piped from STDIN into a Brick program. Because the
inputFdis assigned tostdinby default, I need it to be assigned explicitly to/dev/ttyin order to make the terminal UI interactive.If you compile and run my demo executable in the Ubuntu Terminal (tested on Ubuntu 20.04), pressing SPACE once suspends and pressing ESC once quits -- just like the original demo.
If you run the executable in the MacOS Terminal (macOS Montery, Apple M1 Pro), pressing SPACE or ESC once isn't sufficient. You need to press another key afterward to make the suspend or quit command register. Is this bug, or is there something wrong with my Haskell code?