Title: [187598] trunk/Source/WebInspectorUI
Revision
187598
Author
drou...@apple.com
Date
2015-07-30 12:24:06 -0700 (Thu, 30 Jul 2015)

Log Message

Web Inspector: Add special case for deleting the next character when editing rules in the CSS Sidebar
https://bugs.webkit.org/show_bug.cgi?id=147442

Reviewed by Timothy Hatcher.

If the cursor is on the first position of the first line in a CSS Rule and that line
has no content, delete the line instead of doing nothing.

* UserInterface/Views/CSSStyleDeclarationTextEditor.js:
(WebInspector.CSSStyleDeclarationTextEditor.prototype._handleBeforeChange):

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (187597 => 187598)


--- trunk/Source/WebInspectorUI/ChangeLog	2015-07-30 19:13:49 UTC (rev 187597)
+++ trunk/Source/WebInspectorUI/ChangeLog	2015-07-30 19:24:06 UTC (rev 187598)
@@ -1,3 +1,16 @@
+2015-07-30  Devin Rousso  <drou...@apple.com>
+
+        Web Inspector: Add special case for deleting the next character when editing rules in the CSS Sidebar
+        https://bugs.webkit.org/show_bug.cgi?id=147442
+
+        Reviewed by Timothy Hatcher.
+
+        If the cursor is on the first position of the first line in a CSS Rule and that line
+        has no content, delete the line instead of doing nothing.
+
+        * UserInterface/Views/CSSStyleDeclarationTextEditor.js:
+        (WebInspector.CSSStyleDeclarationTextEditor.prototype._handleBeforeChange):
+
 2015-07-29  Nikita Vasilyev  <nvasil...@apple.com>
 
         Web Inspector: Improve styles of debugger popovers

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js (187597 => 187598)


--- trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js	2015-07-30 19:13:49 UTC (rev 187597)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js	2015-07-30 19:24:06 UTC (rev 187598)
@@ -474,11 +474,22 @@
 
     _handleBeforeChange(codeMirror, change)
     {
-        if (change.origin !== "+delete" || (!change.to.line && !change.to.ch) || this._completionController.isShowingCompletions())
+        if (change.origin !== "+delete" || this._completionController.isShowingCompletions())
             return CodeMirror.Pass;
 
+        if (!change.to.line && !change.to.ch) {
+            if (codeMirror.lineCount() === 1)
+                return CodeMirror.Pass;
+
+            var line = codeMirror.getLine(change.to.line);
+            if (line && line.trim().length)
+                return CodeMirror.Pass;
+
+            codeMirror.execCommand("deleteLine");
+            return;
+        }
+
         var marks = codeMirror.findMarksAt(change.to);
-
         if (!marks.length)
             return CodeMirror.Pass;
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to