pashapm / lanterna

Automatically exported from code.google.com/p/lanterna
GNU Lesser General Public License v3.0
0 stars 0 forks source link

Sevral key combinations are interpreted as Escape #62

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,

On my computer the following combinations are read as kind Key.Escape:
Shift/Ctrl/Alt + ArrowUp/ArrowDown/ArrowLeft/ArrowRight/Delete
Ctrl/Alt + PageUp/PageDown
Alt + 
Backspace/Insert/Apostrophe(')/Comma(,)/Dot(.)/Minus(-)/Dollar($)/LessThan(<)
Ctrl + 3

I'm working on a Swiss keyboard (like this one 
http://images.esellerpro.com/2131/I/733/49/93P4762.JPG). Here is the code I 
used:

import com.googlecode.lanterna.TerminalFacade;
import com.googlecode.lanterna.input.Key;
import com.googlecode.lanterna.input.Key.Kind;
import com.googlecode.lanterna.screen.Screen;
public class Test {
    public static void main(String[] args) throws InterruptedException {
      Screen s = new Screen(TerminalFacade.createTextTerminal());
      s.startScreen();
      for(;;) {
        Key k = s.readInput();
        if (k != null && k.getKind() == Kind.Escape) System.out.println("Escape");
        if (k != null && k.getKind() == Kind.Tab) break;
        Thread.sleep(1);
      }
      s.stopScreen();
    }
}

Original issue reported on code.google.com by olivierb...@gmail.com on 15 Jan 2013 at 5:38

GoogleCodeExporter commented 9 years ago
Hi,
Which terminal emulator are you using when you get this behaviour? Or using the 
built-in SwingTerminal?

Original comment by mab...@gmail.com on 20 Jan 2013 at 1:50

GoogleCodeExporter commented 9 years ago
Hi,
I'm using a gnome terminal. I just tested with a SwingTerminal and it appears 
to handle this combinations properly.

Original comment by olivierb...@gmail.com on 20 Jan 2013 at 5:38

GoogleCodeExporter commented 9 years ago
I just remembered that I probably didn't add support for ctrl/shift/alt with 
non-alphanumeric keys when using a 'proper' terminal. We should have a look 
into this. I don't think we can support all combinations though, but at least 
some of them should work.

Original comment by mab...@gmail.com on 21 Jan 2013 at 12:19

GoogleCodeExporter commented 9 years ago
As it turns out, while adding more key code profiles, I've found a blind spot 
in the input decoder which makes many shift+special key combinations impossible 
to decode. The input decoder needs to be rewritten for this to work; on 2.1.x 
branch I'll just add a few more profiles that does work. For default branch 
I'll try re-writing it.

Original comment by mab...@gmail.com on 27 Jan 2013 at 3:44