Title: [186286] trunk/Source/WebInspectorUI
Revision
186286
Author
drou...@apple.com
Date
2015-07-04 14:51:32 -0700 (Sat, 04 Jul 2015)

Log Message

Web Inspector: Wrong cursor position in styles panel when deleting a line break
https://bugs.webkit.org/show_bug.cgi?id=146577

Reviewed by Timothy Hatcher.

* UserInterface/Views/CSSStyleDeclarationTextEditor.js:
(WebInspector.CSSStyleDeclarationTextEditor):
(WebInspector.CSSStyleDeclarationTextEditor.prototype._handleBeforeChange): If the change is a deletion at the beginning of a line,
remove all markers on that line to ensure that there is no blank space on the previous line after deleting.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (186285 => 186286)


--- trunk/Source/WebInspectorUI/ChangeLog	2015-07-04 21:49:54 UTC (rev 186285)
+++ trunk/Source/WebInspectorUI/ChangeLog	2015-07-04 21:51:32 UTC (rev 186286)
@@ -1,5 +1,17 @@
 2015-07-04  Devin Rousso  <drou...@apple.com>
 
+        Web Inspector: Wrong cursor position in styles panel when deleting a line break
+        https://bugs.webkit.org/show_bug.cgi?id=146577
+
+        Reviewed by Timothy Hatcher.
+
+        * UserInterface/Views/CSSStyleDeclarationTextEditor.js:
+        (WebInspector.CSSStyleDeclarationTextEditor):
+        (WebInspector.CSSStyleDeclarationTextEditor.prototype._handleBeforeChange): If the change is a deletion at the beginning of a line,
+        remove all markers on that line to ensure that there is no blank space on the previous line after deleting.
+
+2015-07-04  Devin Rousso  <drou...@apple.com>
+
         Web Inspector: Pressing tab on a newline in the console should insert a tab character
         https://bugs.webkit.org/show_bug.cgi?id=146612
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js (186285 => 186286)


--- trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js	2015-07-04 21:49:54 UTC (rev 186285)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js	2015-07-04 21:51:32 UTC (rev 186286)
@@ -83,6 +83,7 @@
         // Otherwise we end up in race conditions during complete or delete-complete phases.
         this._codeMirror.on("change", this._contentChanged.bind(this));
         this._codeMirror.on("blur", this._editorBlured.bind(this));
+        this._codeMirror.on("beforeChange", this._handleBeforeChange.bind(this));
 
         if (typeof this._delegate.cssStyleDeclarationTextEditorFocused === "function")
             this._codeMirror.on("focus", this._editorFocused.bind(this));
@@ -438,6 +439,20 @@
         this._mouseDownCursorPosition = null;
     }
 
+    _handleBeforeChange(codeMirror, change)
+    {
+        if (change.origin !== "+delete" || change.to.ch)
+            return CodeMirror.Pass;
+
+        var marks = codeMirror.findMarksAt(change.to);
+
+        if (!marks.length)
+            return CodeMirror.Pass;
+
+        for (var mark of marks)
+            mark.clear();
+    }
+
     _handleEnterKey(codeMirror)
     {
         var cursor = codeMirror.getCursor();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to