Title: [204755] trunk/Source/WebInspectorUI
Revision
204755
Author
commit-qu...@webkit.org
Date
2016-08-22 22:12:32 -0700 (Mon, 22 Aug 2016)

Log Message

Web Inspector: Entering ":n" in Open Resource Dialog, where n > number of lines, should jump to the last line
https://bugs.webkit.org/show_bug.cgi?id=160840

Patch by Devin Rousso <dcrousso+web...@gmail.com> on 2016-08-22
Reviewed by Joseph Pecoraro.

* UserInterface/Views/TextEditor.js:
(TextEditor.prototype.revealPosition):
Limit the given line and column to the maximum number of lines and the column count on the
resulting line.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (204754 => 204755)


--- trunk/Source/WebInspectorUI/ChangeLog	2016-08-23 04:47:27 UTC (rev 204754)
+++ trunk/Source/WebInspectorUI/ChangeLog	2016-08-23 05:12:32 UTC (rev 204755)
@@ -1,5 +1,17 @@
 2016-08-22  Devin Rousso  <dcrousso+web...@gmail.com>
 
+        Web Inspector: Entering ":n" in Open Resource Dialog, where n > number of lines, should jump to the last line
+        https://bugs.webkit.org/show_bug.cgi?id=160840
+
+        Reviewed by Joseph Pecoraro.
+
+        * UserInterface/Views/TextEditor.js:
+        (TextEditor.prototype.revealPosition):
+        Limit the given line and column to the maximum number of lines and the column count on the
+        resulting line.
+
+2016-08-22  Devin Rousso  <dcrousso+web...@gmail.com>
+
         Web Inspector: Add indicator to matched selector being a pseudo-element
         https://bugs.webkit.org/show_bug.cgi?id=160893
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TextEditor.js (204754 => 204755)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TextEditor.js	2016-08-23 04:47:27 UTC (rev 204754)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TextEditor.js	2016-08-23 05:12:32 UTC (rev 204755)
@@ -428,7 +428,7 @@
         if (!(position instanceof WebInspector.SourceCodePosition))
             return;
 
-        var lineHandle = this._codeMirror.getLineHandle(position.lineNumber);
+        let lineHandle = this._codeMirror.getLineHandle(position.lineNumber);
         if (!lineHandle || !this._visible || this._initialStringNotSet || this._deferReveal) {
             // If we can't get a line handle or are not visible then we wait to do the reveal.
             this._positionToReveal = position;
@@ -451,9 +451,15 @@
             return;
         }
 
-        if (!textRangeToSelect)
-            textRangeToSelect = new WebInspector.TextRange(position.lineNumber, position.columnNumber, position.lineNumber, position.columnNumber);
+        let line = Number.constrain(position.lineNumber, 0, this._codeMirror.lineCount() - 1);
+        if (line !== position.lineNumber)
+            lineHandle = this._codeMirror.getLineHandle(line);
 
+        if (!textRangeToSelect) {
+            let column = Number.constrain(position.columnNumber, 0, this._codeMirror.getLine(line).length - 1);
+            textRangeToSelect = new WebInspector.TextRange(line, column, line, column);
+        }
+
         function removeStyleClass()
         {
             this._codeMirror.removeLineClass(lineHandle, "wrap", WebInspector.TextEditor.HighlightedStyleClassName);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to