Title: [186227] trunk/Source/WebInspectorUI
Revision
186227
Author
drou...@apple.com
Date
2015-07-02 10:31:57 -0700 (Thu, 02 Jul 2015)

Log Message

Web Inspector: Show suggest popover on Tab press even if it wasn't showing before
https://bugs.webkit.org/show_bug.cgi?id=146496

Reviewed by Timothy Hatcher.

* UserInterface/Views/CSSStyleDeclarationTextEditor.js:
(WebInspector.CSSStyleDeclarationTextEditor.prototype._handleTabKey): Pressing tab will try to autocomplete before trying
to add an ending colon/semicolon or highlight the next section of text.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (186226 => 186227)


--- trunk/Source/WebInspectorUI/ChangeLog	2015-07-02 16:04:01 UTC (rev 186226)
+++ trunk/Source/WebInspectorUI/ChangeLog	2015-07-02 17:31:57 UTC (rev 186227)
@@ -1,3 +1,14 @@
+2015-07-02  Devin Rousso  <drou...@apple.com>
+
+        Web Inspector: Show suggest popover on Tab press even if it wasn't showing before
+        https://bugs.webkit.org/show_bug.cgi?id=146496
+
+        Reviewed by Timothy Hatcher.
+
+        * UserInterface/Views/CSSStyleDeclarationTextEditor.js:
+        (WebInspector.CSSStyleDeclarationTextEditor.prototype._handleTabKey): Pressing tab will try to autocomplete before trying
+        to add an ending colon/semicolon or highlight the next section of text.
+
 2015-07-01  Joseph Pecoraro  <pecor...@apple.com>
 
         Web Inspector: Aggregate profile call information on the backend to drastically reduce profile sizes

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js (186226 => 186227)


--- trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js	2015-07-02 16:04:01 UTC (rev 186226)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js	2015-07-02 17:31:57 UTC (rev 186227)
@@ -556,30 +556,30 @@
         var hasEndingSemicolon = trimmedLine.endsWith(";");
 
         if (cursor.ch >= line.trimRight().length - hasEndingSemicolon) {
-            if (!line.includes(":")) {
-                codeMirror.setCursor(cursor.line, line.length);
-                codeMirror.replaceRange(": ", cursor);
-                return;
-            }
+            this._completionController.completeAtCurrentPositionIfNeeded().then(function(result) {
+                if (result !== WebInspector.CodeMirrorCompletionController.UpdatePromise.NoCompletionsFound)
+                    return;
 
-            var replacement = "";
+                var replacement = "";
 
-            if (!hasEndingSemicolon)
-                replacement += ";";
+                if (!hasEndingSemicolon)
+                    replacement += ";";
 
-            if (lastLine)
-                replacement += "\n";
+                if (lastLine)
+                    replacement += "\n";
 
-            if (replacement.length)
-                codeMirror.replaceRange(replacement, {line: cursor.line, ch: trimmedLine.length});
+                if (replacement.length)
+                    codeMirror.replaceRange(replacement, {line: cursor.line, ch: trimmedLine.length});
 
-            if (!nextLine) {
-                codeMirror.setCursor(cursor.line + 1, 0);
-                return;
-            }
+                if (!nextLine) {
+                    codeMirror.setCursor(cursor.line + 1, 0);
+                    return;
+                }
 
-            var colon = nextLine.indexOf(":");
-            codeMirror.setSelection({line: cursor.line + 1, ch: 0}, {line: cursor.line + 1, ch: colon < 0 ? trimmedNextLine.length : colon});
+                var colon = nextLine.indexOf(":");
+                codeMirror.setSelection({line: cursor.line + 1, ch: 0}, {line: cursor.line + 1, ch: colon < 0 ? trimmedNextLine.length : colon});
+            }.bind(this));
+
             return;
         }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to