Pārlūkot izejas kodu

HUE-6202 [editor] Update the right assistant when navigating using the keyboard

Johan Ahlen 8 gadi atpakaļ
vecāks
revīzija
94ed7f5

+ 10 - 5
desktop/core/src/desktop/static/desktop/js/ko.hue-bindings.js

@@ -3707,16 +3707,21 @@
         editor.off('focus', focusListener);
       });
 
-      var changeSelectionThrottle = -1;
-      var changeSelectionListener = editor.selection.on('changeSelection', function () {
-        window.clearTimeout(changeSelectionThrottle);
-        changeSelectionThrottle = window.setTimeout(function () {
+      var changeCursorThrottle = -1;
+      var changeCursorListener = editor.selection.on('changeCursor', function () {
+        window.clearTimeout(changeCursorThrottle);
+        changeCursorThrottle = window.setTimeout(function () {
           huePubSub.publish('editor.active.cursor.location', { id: $el.attr("id"), position: editor.getCursorPosition(), editor: editor });
-        }, 100);
+        }, 150);
+      });
+
+      var changeSelectionListener = editor.selection.on('changeSelection', function () {
         snippet.selectedStatement(editor.getSelectedText());
       });
 
       disposeFunctions.push(function () {
+        window.clearTimeout(changeCursorThrottle);
+        editor.selection.off('changeCursor', changeCursorListener);
         editor.selection.off('changeSelection', changeSelectionListener);
       });