remove Swing input map, which might bind keys in unexpected ways (e.g. LEFT/RIGHT in singleton list);
authorwenzelm
Wed Sep 04 12:20:00 2013 +0200 (2013-09-04 ago)
changeset 53398f8b150e8778b
parent 53397 b179cdfa9d82
child 53399 43b3b3fa6967
remove Swing input map, which might bind keys in unexpected ways (e.g. LEFT/RIGHT in singleton list);
handle KP_UP/KP_DOWN keys as well, like Swing does;
NEWS
src/Tools/jEdit/src/completion_popup.scala
     1.1 --- a/NEWS	Wed Sep 04 11:12:00 2013 +0200
     1.2 +++ b/NEWS	Wed Sep 04 12:20:00 2013 +0200
     1.3 @@ -101,7 +101,7 @@
     1.4  
     1.5    - Light-weight popup, which avoids explicit window (more reactive
     1.6      and more robust).  Interpreted key events include TAB, ESCAPE, UP,
     1.7 -    DOWN, PAGE_UP, PAGE_DOWN.  Uninterpreted key events are passed to
     1.8 +    DOWN, PAGE_UP, PAGE_DOWN.  All other key events are passed to
     1.9      the jEdit text area.
    1.10  
    1.11    - Explicit completion via standard jEdit shortcut C+b, which has
     2.1 --- a/src/Tools/jEdit/src/completion_popup.scala	Wed Sep 04 11:12:00 2013 +0200
     2.2 +++ b/src/Tools/jEdit/src/completion_popup.scala	Wed Sep 04 12:20:00 2013 +0200
     2.3 @@ -244,6 +244,11 @@
     2.4    list_view.peer.setVisibleRowCount(items.length min 8)
     2.5    list_view.peer.setSelectedIndex(0)
     2.6  
     2.7 +  for (cond <-
     2.8 +    List(JComponent.WHEN_FOCUSED,
     2.9 +      JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT,
    2.10 +      JComponent.WHEN_IN_FOCUSED_WINDOW)) list_view.peer.setInputMap(cond, null)
    2.11 +
    2.12    private def complete_selected(): Boolean =
    2.13    {
    2.14      list_view.selection.items.toList match {
    2.15 @@ -283,8 +288,8 @@
    2.16                case KeyEvent.VK_ESCAPE =>
    2.17                  hide_popup()
    2.18                  e.consume
    2.19 -              case KeyEvent.VK_UP => move_items(-1); e.consume
    2.20 -              case KeyEvent.VK_DOWN => move_items(1); e.consume
    2.21 +              case KeyEvent.VK_UP | KeyEvent.VK_KP_UP => move_items(-1); e.consume
    2.22 +              case KeyEvent.VK_DOWN | KeyEvent.VK_KP_DOWN => move_items(1); e.consume
    2.23                case KeyEvent.VK_PAGE_UP => move_pages(-1); e.consume
    2.24                case KeyEvent.VK_PAGE_DOWN => move_pages(1); e.consume
    2.25                case _ =>