Arrow keys support for Windows client
Now that Windows client has colors (#1290) it is possible to continue experimenting with #1236. And the next problem is inability to use cursor keys and special keys. They are just not transmitted by Windows side. This can be tested by pressing Ctrl+V and corresponding key. See details in https://superuser.com/questions/997696/show-keys-pressed-in-custom-console
The os.Stdin is passed here - https://github.com/lxc/lxd/blob/71e56e4be5920e09369cdecbdada38cd19f041f8/lxc/exec.go#L128 and it may not be able to handle arrow keys etc.
Also, if I try to type less in the terminal, it complains:
>lxc exec isphinx bash
root@isphinx:~# less
WARNING: terminal is not fully functional
Missing filename ("less --help" for help)
Any ideas why it thinks so?
Need to set terminal type to dumb. More info:
https://stackoverflow.com/questions/39001517/features-obligatory-for-term-dumb-terminal
Which @tych0 did yesterday.
Yes. Here https://github.com/lxc/lxd/pull/2536 to be exact. But that's not enough to make arrow keys going. Need some lib/interface to intercept keys in Windows console.
@techtonik is correct, there definitely needs to be a handler to translate the Windows key events into the corresponding ANSI sequences. @Maximus5 wrote a rundown on this exact issue in regard to ConEmu and BashOnWindows found here.
I started with https://github.com/yakshaveinc/go-keycodes to provide universal key codes for translation. I hope to submit it to golang as official dataset, but got stuck in the process. There are few libraries that allow to read keypresses on Windows, but again, it is not paid job, so it will have to wait.
@techtonik Thanks. It's good to know someone is working on it.
I may try a different route like using ConEmu with their compatibility features as a work around in the meantime. I may experiment with creating a Hyper plugin to do the same, as well. If I get anything working I'll report back.
Tracked here - https://github.com/golang/go/issues/19503