vi / websocat

Command-line client for WebSockets, like netcat (or curl) for ws:// with advanced socat-like functions
MIT License
6.74k stars 261 forks source link

Arrow keys not working #57

Open string-areeb opened 4 years ago

string-areeb commented 4 years ago

Left and right arrow keys don't work, requiring clearing all text up to the point we want to change the text using backspace.

At least, arrow keys should be supported from the readline keyboard shortcuts

vi commented 4 years ago

Recommended way to use websocat with readline features is to use external program rlwrap:

rlwrap websocat ws://echo.websocket.org/

Are there any cons for this method apart from requiring installation of additional program? If there are real advantages I may add readline: specifier and maybe make it default for interactive mode.

Maybe I need to mention rlwrap in README.

string-areeb commented 4 years ago

Most people assume at least to be able to use arrow keys of left or right to make quick edits in the text. Up key to cycle through previous commands may be out of scope, but I think at least supporting left and right keys would be a good start as most CLI tools support it

vi commented 4 years ago

least supporting left and right keys

Being able to use left/right/up/down arrows is a readline feature. It usually makes no sense to manually re-implement some of its features.

Note: being able to erase last character (backspace key) is a bit of exception and is typically supported in kernel, so works even with non-readline programs.

most CLI tools support it

Most CLI tools use readline library (or some analogue). Maybe Websocat should use it too. For now, as a workaround, you can add this support yourself by using rlwrap, which "readlinifies" other programs.