Skip to content
Permalink
Browse files
2010-04-14 Alexander Pavlov <apavlov@chromium.org>
        Reviewed by Timothy Hatcher.

        Web Inspector: Console: Shift-Tab does not cycle autocompletions in the reverse order
        https://bugs.webkit.org/show_bug.cgi?id=37582

        * inspector/front-end/TextPrompt.js:
        (WebInspector.TextPrompt.prototype.complete):
        (WebInspector.TextPrompt.prototype._completionsReady):
        (WebInspector.TextPrompt.prototype._tabKeyPressed):

Canonical link: https://commits.webkit.org/48880@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@57592 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
eseidel committed Apr 14, 2010
1 parent 56495c0 commit d07741cdc533607ea4a87c78332c36cb18592198
Showing 2 changed files with 21 additions and 6 deletions.
@@ -1,3 +1,15 @@
2010-04-14 Alexander Pavlov <apavlov@chromium.org>

Reviewed by Timothy Hatcher.

Web Inspector: Console: Shift-Tab does not cycle autocompletions in the reverse order
https://bugs.webkit.org/show_bug.cgi?id=37582

* inspector/front-end/TextPrompt.js:
(WebInspector.TextPrompt.prototype.complete):
(WebInspector.TextPrompt.prototype._completionsReady):
(WebInspector.TextPrompt.prototype._tabKeyPressed):

2010-04-14 Jeff Schiller <codedread@gmail.com>

Reviewed by Dirk Schulze.
@@ -172,7 +172,7 @@ WebInspector.TextPrompt.prototype = {
this._completeTimeout = setTimeout(this.complete.bind(this, true), 250);
},

complete: function(auto)
complete: function(auto, reverse)
{
this.clearAutoComplete(true);
var selection = window.getSelection();
@@ -185,10 +185,10 @@ WebInspector.TextPrompt.prototype = {
if (auto && !this.isCaretAtEndOfPrompt())
return;
var wordPrefixRange = selectionRange.startContainer.rangeOfWord(selectionRange.startOffset, this.completionStopCharacters, this.element, "backward");
this.completions(wordPrefixRange, auto, this._completionsReady.bind(this, selection, auto, wordPrefixRange));
this.completions(wordPrefixRange, auto, this._completionsReady.bind(this, selection, auto, wordPrefixRange, reverse));
},

_completionsReady: function(selection, auto, originalWordPrefixRange, completions)
_completionsReady: function(selection, auto, originalWordPrefixRange, reverse, completions)
{
if (!completions || !completions.length)
return;
@@ -212,10 +212,13 @@ WebInspector.TextPrompt.prototype = {
if (completions[i] === currentText)
foundIndex = i;

if (foundIndex === null || (foundIndex + 1) >= completions.length)
var nextIndex = foundIndex + (reverse ? -1 : 1);
if (foundIndex === null || nextIndex >= completions.length)
var completionText = completions[0];
else if (nextIndex < 0)
var completionText = completions[completions.length - 1];
else
var completionText = completions[foundIndex + 1];
var completionText = completions[nextIndex];
}

var wordPrefixLength = originalWordPrefixRange.toString().length;
@@ -354,7 +357,7 @@ WebInspector.TextPrompt.prototype = {
event.preventDefault();
event.stopPropagation();

this.complete();
this.complete(false, event.shiftKey);
},

_upKeyPressed: function(event)

0 comments on commit d07741c

Please sign in to comment.