Open segevfiner opened 2 years ago
Here's a POC of how to do this on Windows https://github.com/segevfiner/qt-embedded-terminal-poc (Linux/macOS can be done the same just using the standard library pty
module). This is a bit heavier than otherwise possible due to embedding and using xterm.js
since I'm not familiar with a cross-platform (That is, works on Windows), Qt terminal widget.
Note that if you need this on the same process as the one you are running from, besides reopening stdio to the slave PTY, you might also have to detach from the controlling terminal (I think TIOCNOTTY
) on Unix-likes to establish the pty as the controlling terminal, and being careful on where signals generated in the terminal are sent so Cutter doesn't quit when you Ctrl-C in the terminal, and on Windows to run a subprocess with the PTY and AttachConsole
using its PID.
We would love to have a better console experience, very much. With that, we are also dreaming of having a proper ipython console inside Cutter, that will smoothly work with our Python API. Do you see a way for these two features to work together seamlessly?
Regarding embedding JS-written console, I don't know... @karliss @yossizap what do you think about it?
Yeah. IPython should be capable of running inside a pty/conpty/winpty, that's how it already works inside VS Code and other similar IDEs.
The other alternative might be porting QTermWidget
to Windows. I haven't yet checked how much platform specific code is in it.
Just a note about Python REPLs though. Threading can be a concern, if you run the Python REPL in the UI thread it will obviously cause Cutter to hang while running without integrating the Qt event loop with the Python REPL (There are tricks to do that). Running it in a separate thread depends on Rizin/Cutter's thread safety and the APIs they wish to expose to Python.
The other alternative might be porting
QTermWidget
to Windows. I haven't yet checked how much platform specific code is in it.
done in gnu octave https://github.com/lxqt/qtermwidget/issues/42#issuecomment-605078744 https://github.com/gnu-octave/octave/tree/default/libgui/qterminal/libqterminal
Is your feature request related to a problem? Please describe. The current console widget seems to be just a plain text box, likely limiting the ability to run more complex console programs in it. It also doesn't use a pty, but likely just plain pipes for output redirection.
Considering how terminal centric plain Rizin is, it would make sense to make it easy to work seamlessly with both Cutter GUI and Rizin terminal interface with the same level of functionality as running plain Rizin in a terminal.
Describe the solution you'd like
It would be interesting if the console/terminal in cutter was a full blown vt100/xterm terminal that could possibly fully support even Rizin's visual mode.
This requires two components:
At that point improving the UX of that widget by giving it a shortcut to expand it to full screen/window and collapse it and such might also begin to make sense.
Describe alternatives you've considered
Switch between rizin & cutter as needed.
Additional context
You can check out the implementation in VS Code for ideas on how to achieve this.