browsh-org / browsh

A fully-modern text-based browser, rendering to TTY and browsers
https://www.brow.sh
GNU Lesser General Public License v2.1
16.8k stars 411 forks source link

Support suspending with ctrl+z and gracefully resume #239

Open tobimensch opened 5 years ago

tobimensch commented 5 years ago

This shortcut is known from terminal programs like vim, emacs and others (in fact it is almost universally supported). When the user presses ctrl+z, the running program (browsh) disappears and on the terminal it looks as if the program was quit. Since the program was only suspended into the background, it can be resumed at any time by typing fg and enter.

I think this could be useful for browsh users, because they could do some work on the command line, and continue to read the same website later. Of course they could also use something such as tmux or simply multiple terminals, however sometimes you might not have a terminal multiplexer running or installed, or you might indeed prefer not to switch to another terminal, because it fits your workflow best.

tobimensch commented 5 years ago

We've to wait for the tcell project to fix this https://github.com/gdamore/tcell/issues/194 .

tomrow commented 5 years ago

I think that the ^Z key combination may not be the best idea for suspension as it may interfere with Undo when typing in textboxes. Maybe try PauseBreak instead?

tobimensch commented 5 years ago

@tomrow Key combinations will be configurable. :-)

kgfly commented 5 years ago

+1, ctrl-z should be the most common key for emacs, vim .....

"jobs" list all background process.

"fg #" resumes specific process.

This is useful if you're under a real/pure terminal instead of GUI terminal.

kgfly commented 5 years ago

On Windows, it's little different, since it does not have jobs/fg commands.

c-z to return to batch. exit to return back to the exe, eg vim.