From be62ea33bc99c813f5cb2374c1b9a117a1316dae Mon Sep 17 00:00:00 2001 From: Jennifer Fong Date: Tue, 21 Apr 2015 09:28:00 -0400 Subject: [PATCH] Bug 1032984 - Fix Shift+Home/End/PageUp/PageDown to highlight value. r=bgrins --HG-- extra : rebase_source : ce1c811725e43245729b2bf2b02cdf77257151ae --- browser/devtools/shared/inplace-editor.js | 8 ++++++++ .../browser_ruleview_completion-existing-property_01.js | 8 ++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/browser/devtools/shared/inplace-editor.js b/browser/devtools/shared/inplace-editor.js index 522da18432d6..e1d39b05552a 100644 --- a/browser/devtools/shared/inplace-editor.js +++ b/browser/devtools/shared/inplace-editor.js @@ -882,6 +882,14 @@ InplaceEditor.prototype = { increment *= smallIncrement; } + // Use default cursor movement rather than providing auto-suggestions. + if (aEvent.keyCode === Ci.nsIDOMKeyEvent.DOM_VK_HOME + || aEvent.keyCode === Ci.nsIDOMKeyEvent.DOM_VK_END + || aEvent.keyCode === Ci.nsIDOMKeyEvent.DOM_VK_PAGE_UP + || aEvent.keyCode === Ci.nsIDOMKeyEvent.DOM_VK_PAGE_DOWN) { + this._preventSuggestions = true; + } + let cycling = false; if (increment && this._incrementValue(increment) ) { this._updateSize(); diff --git a/browser/devtools/styleinspector/test/browser_ruleview_completion-existing-property_01.js b/browser/devtools/styleinspector/test/browser_ruleview_completion-existing-property_01.js index f8c7aa715f05..fbca6f20a610 100644 --- a/browser/devtools/styleinspector/test/browser_ruleview_completion-existing-property_01.js +++ b/browser/devtools/styleinspector/test/browser_ruleview_completion-existing-property_01.js @@ -42,6 +42,10 @@ let testData = [ ["VK_BACK_SPACE", "di", -1, 0], ["VK_BACK_SPACE", "d", -1, 0], ["VK_BACK_SPACE", "", -1, 0], + ["VK_HOME", "", -1, 0], + ["VK_END", "", -1, 0], + ["VK_PAGE_UP", "", -1, 0], + ["VK_PAGE_DOWN", "", -1, 0], ["f", "fill", 0, MAX_ENTRIES], ["i", "fill", 0, 4], ["VK_LEFT", "fill", -1, 0], @@ -76,8 +80,8 @@ function* testCompletion([key, completion, index, total], editor, view) { let onSuggest; - if (/(left|right|back_space|escape)/ig.test(key)) { - info("Adding event listener for left|right|back_space|escape keys"); + if (/(left|right|back_space|escape|home|end|page_up|page_down)/ig.test(key)) { + info("Adding event listener for left|right|back_space|escape|home|end|page_up|page_down keys"); onSuggest = once(editor.input, "keypress"); } else { info("Waiting for after-suggest event on the editor");