浏览代码

HUE-7272 [autocomplete] Cycle the autocomplete suggestions on up/down at the limits

Johan Ahlen 8 年之前
父节点
当前提交
11e5323
共有 1 个文件被更改,包括 6 次插入0 次删除
  1. 6 0
      desktop/core/src/desktop/templates/hue_ace_autocompleter.mako

+ 6 - 0
desktop/core/src/desktop/templates/hue_ace_autocompleter.mako

@@ -332,6 +332,9 @@ from desktop.views import _ko
             } else if (self.selectedIndex() > 0) {
               self.selectedIndex(self.selectedIndex() - 1);
               self.scrollSelectionIntoView();
+            } else {
+              self.selectedIndex(self.suggestions.filtered().length - 1);
+              self.scrollSelectionIntoView();
             }
           },
           'Down': function(editor) {
@@ -341,6 +344,9 @@ from desktop.views import _ko
             } else if (self.selectedIndex() < self.suggestions.filtered().length - 1) {
               self.selectedIndex(self.selectedIndex() + 1);
               self.scrollSelectionIntoView();
+            } else {
+              self.selectedIndex(0);
+              self.scrollSelectionIntoView();
             }
           },
           'Ctrl-Up|Ctrl-Home': function() {