lxd icon indicating copy to clipboard operation
lxd copied to clipboard

Arrow keys support for Windows client

Open techtonik opened this issue 10 years ago • 9 comments

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

techtonik avatar Nov 17 '15 21:11 techtonik

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.

techtonik avatar Nov 17 '15 22:11 techtonik

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?

techtonik avatar Feb 01 '16 20:02 techtonik

Need to set terminal type to dumb. More info:

https://stackoverflow.com/questions/39001517/features-obligatory-for-term-dumb-terminal

techtonik avatar Oct 21 '16 06:10 techtonik

Which @tych0 did yesterday.

stgraber avatar Oct 21 '16 13:10 stgraber

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 avatar Oct 21 '16 15:10 techtonik

@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.

msimpson avatar May 10 '17 20:05 msimpson

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 avatar May 10 '17 21:05 techtonik

@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.

msimpson avatar May 11 '17 15:05 msimpson

Tracked here - https://github.com/golang/go/issues/19503

techtonik avatar May 11 '17 16:05 techtonik