Title: [111675] trunk/Source/WebCore
Revision
111675
Author
[email protected]
Date
2012-03-22 05:52:35 -0700 (Thu, 22 Mar 2012)

Log Message

Web Inspector: breakpoints should shift when line break is inserted in the middle of the line.
https://bugs.webkit.org/show_bug.cgi?id=81896

Reviewed by Vsevolod Vlasov.

There is a bug that collapses selection prior to exiting change mode, we should never
collapse edit area prior committing.

* inspector/front-end/TextEditorModel.js:
(WebInspector.TextEditorModel.endsWithBracketRegex.):
* inspector/front-end/TextViewer.js:
(WebInspector.TextViewer):
(WebInspector.TextEditorMainPanel.prototype.highlightLine):
(WebInspector.TextEditorMainPanel.prototype.handleUndoRedo.callback):
(WebInspector.TextEditorMainPanel.prototype.handleUndoRedo):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (111674 => 111675)


--- trunk/Source/WebCore/ChangeLog	2012-03-22 12:51:40 UTC (rev 111674)
+++ trunk/Source/WebCore/ChangeLog	2012-03-22 12:52:35 UTC (rev 111675)
@@ -1,3 +1,21 @@
+2012-03-22  Pavel Feldman  <[email protected]>
+
+        Web Inspector: breakpoints should shift when line break is inserted in the middle of the line.
+        https://bugs.webkit.org/show_bug.cgi?id=81896
+
+        Reviewed by Vsevolod Vlasov.
+
+        There is a bug that collapses selection prior to exiting change mode, we should never
+        collapse edit area prior committing.
+
+        * inspector/front-end/TextEditorModel.js:
+        (WebInspector.TextEditorModel.endsWithBracketRegex.):
+        * inspector/front-end/TextViewer.js:
+        (WebInspector.TextViewer):
+        (WebInspector.TextEditorMainPanel.prototype.highlightLine):
+        (WebInspector.TextEditorMainPanel.prototype.handleUndoRedo.callback):
+        (WebInspector.TextEditorMainPanel.prototype.handleUndoRedo):
+
 2012-03-22  Zoltan Herczeg  <[email protected]>
 
         Merge SVGImageBufferTools to SVGRenderingContext

Modified: trunk/Source/WebCore/inspector/front-end/TextEditorModel.js (111674 => 111675)


--- trunk/Source/WebCore/inspector/front-end/TextEditorModel.js	2012-03-22 12:51:40 UTC (rev 111674)
+++ trunk/Source/WebCore/inspector/front-end/TextEditorModel.js	2012-03-22 12:52:35 UTC (rev 111675)
@@ -130,7 +130,10 @@
             range = new WebInspector.TextRange(0, 0, this._lines.length - 1, this._lines[this._lines.length - 1].length);
             this._lineBreak = /\r\n/.test(text) ? "\r\n" : "\n";
         }
-        var command = this._pushUndoableCommand(range);
+        var command = this._pushUndoableCommand(range, text);
+        if (!command)
+            return range; // Noop
+
         var newRange = this._innerSetText(range, text);
         command.range = newRange.clone();
 
@@ -257,7 +260,7 @@
             delete attrs[name];
     },
 
-    _pushUndoableCommand: function(range)
+    _pushUndoableCommand: function(range, text)
     {
         var command = {
             text: this.copyRange(range),
@@ -266,6 +269,9 @@
             endLine: range.startLine,
             endColumn: range.startColumn
         };
+        if (text === command.text)
+            return null;
+
         if (this._inUndo)
             this._redoStack.push(command);
         else {

Modified: trunk/Source/WebCore/inspector/front-end/TextViewer.js (111674 => 111675)


--- trunk/Source/WebCore/inspector/front-end/TextViewer.js	2012-03-22 12:51:40 UTC (rev 111674)
+++ trunk/Source/WebCore/inspector/front-end/TextViewer.js	2012-03-22 12:52:35 UTC (rev 111675)
@@ -1023,6 +1023,10 @@
         this.clearLineHighlight();
         this._highlightedLine = lineNumber;
         this.revealLine(lineNumber);
+
+        if (!this._readOnly)
+            this._restoreSelection(new WebInspector.TextRange(lineNumber, 0, lineNumber, 0), false);
+
         this.addDecoration(lineNumber, "webkit-highlighted-line");
     },
 
@@ -1049,18 +1053,19 @@
         this.beginUpdates();
         this._enterTextChangeMode();
 
-        var callback = function(oldRange, newRange) {
+        function callback(oldRange, newRange)
+        {
             this._exitTextChangeMode(oldRange, newRange);
             this._enterTextChangeMode();
-        }.bind(this);
+        }
+        var range = redo ? this._textModel.redo(callback.bind(this)) : this._textModel.undo(callback.bind(this));
+        this._exitTextChangeMode(null, null);
+        this.endUpdates();
 
-        var range = redo ? this._textModel.redo(callback) : this._textModel.undo(callback);
+        // Restore location post-repaint.
         if (range)
             this._setCaretLocation(range.endLine, range.endColumn, true);
 
-        this._exitTextChangeMode(null, null);
-        this.endUpdates();
-
         return true;
     },
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to