interpret keys more movement only when needed;
authorwenzelm
Wed Sep 04 17:35:47 2013 +0200 (2013-09-04 ago)
changeset 53405ed2b48af04d9
parent 53404 d598b6231ff7
child 53406 d4374a69ddff
interpret keys more movement only when needed;
src/Tools/jEdit/src/completion_popup.scala
     1.1 --- a/src/Tools/jEdit/src/completion_popup.scala	Wed Sep 04 16:03:45 2013 +0200
     1.2 +++ b/src/Tools/jEdit/src/completion_popup.scala	Wed Sep 04 17:35:47 2013 +0200
     1.3 @@ -225,7 +225,9 @@
     1.4    completion =>
     1.5  
     1.6    Swing_Thread.require()
     1.7 +
     1.8    require(!items.isEmpty)
     1.9 +  val multi = items.length > 1
    1.10  
    1.11  
    1.12    /* actions */
    1.13 @@ -288,10 +290,14 @@
    1.14                case KeyEvent.VK_ESCAPE =>
    1.15                  hide_popup()
    1.16                  e.consume
    1.17 -              case KeyEvent.VK_UP | KeyEvent.VK_KP_UP => move_items(-1); e.consume
    1.18 -              case KeyEvent.VK_DOWN | KeyEvent.VK_KP_DOWN => move_items(1); e.consume
    1.19 -              case KeyEvent.VK_PAGE_UP => move_pages(-1); e.consume
    1.20 -              case KeyEvent.VK_PAGE_DOWN => move_pages(1); e.consume
    1.21 +              case KeyEvent.VK_UP | KeyEvent.VK_KP_UP if multi =>
    1.22 +                move_items(-1); e.consume
    1.23 +              case KeyEvent.VK_DOWN | KeyEvent.VK_KP_DOWN if multi =>
    1.24 +                move_items(1); e.consume
    1.25 +              case KeyEvent.VK_PAGE_UP if multi =>
    1.26 +                move_pages(-1); e.consume
    1.27 +              case KeyEvent.VK_PAGE_DOWN if multi =>
    1.28 +                move_pages(1); e.consume
    1.29                case _ =>
    1.30                  if (e.isActionKey || e.isAltDown || e.isMetaDown || e.isControlDown)
    1.31                    hide_popup()