Title: [237232] trunk/Source/WebInspectorUI
Revision
237232
Author
drou...@apple.com
Date
2018-10-17 12:46:54 -0700 (Wed, 17 Oct 2018)

Log Message

Web Inspector: Quickly Open to line/column does should have caret indicating where the position is
https://bugs.webkit.org/show_bug.cgi?id=190643

Reviewed by Matt Baker.

* UserInterface/Views/TextEditor.js:
(WI.TextEditor.prototype.set selectedTextRange):
(WI.TextEditor.prototype.revealPosition):
Ensure that CodeMirror is focused before attempting to `setSelection`.
Drive-by: allow selections past the "end" of the line (since there is a `\n` or `\r`).

* UserInterface/Views/SourceCodeTextEditor.js:
(WI.SourceCodeTextEditor.prototype.dialogWasDismissedWithRepresentedObject):
Remove the extra `focus` call after dismissing the `WI.GoToLineDialog` since it is now
handled by `WI.TextEditor` via `revealPosition`.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (237231 => 237232)


--- trunk/Source/WebInspectorUI/ChangeLog	2018-10-17 19:06:49 UTC (rev 237231)
+++ trunk/Source/WebInspectorUI/ChangeLog	2018-10-17 19:46:54 UTC (rev 237232)
@@ -1,3 +1,21 @@
+2018-10-17  Devin Rousso  <drou...@apple.com>
+
+        Web Inspector: Quickly Open to line/column does should have caret indicating where the position is
+        https://bugs.webkit.org/show_bug.cgi?id=190643
+
+        Reviewed by Matt Baker.
+
+        * UserInterface/Views/TextEditor.js:
+        (WI.TextEditor.prototype.set selectedTextRange):
+        (WI.TextEditor.prototype.revealPosition):
+        Ensure that CodeMirror is focused before attempting to `setSelection`.
+        Drive-by: allow selections past the "end" of the line (since there is a `\n` or `\r`).
+
+        * UserInterface/Views/SourceCodeTextEditor.js:
+        (WI.SourceCodeTextEditor.prototype.dialogWasDismissedWithRepresentedObject):
+        Remove the extra `focus` call after dismissing the `WI.GoToLineDialog` since it is now
+        handled by `WI.TextEditor` via `revealPosition`.
+
 2018-10-16  Joseph Pecoraro  <pecor...@apple.com>
 
         Web Inspector: ⌃G to jump to line in CSS file wipes the line

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js (237231 => 237232)


--- trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js	2018-10-17 19:06:49 UTC (rev 237231)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js	2018-10-17 19:46:54 UTC (rev 237232)
@@ -279,9 +279,7 @@
     {
         let position = new WI.SourceCodePosition(lineNumber - 1, 0);
         let range = new WI.TextRange(lineNumber - 1, 0, lineNumber, 0);
-
         this.revealPosition(position, range, false, true);
-        this.focus();
     }
 
     contentDidChange(replacedRanges, newRanges)

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TextEditor.js (237231 => 237232)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TextEditor.js	2018-10-17 19:06:49 UTC (rev 237231)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TextEditor.js	2018-10-17 19:46:54 UTC (rev 237232)
@@ -228,6 +228,7 @@
     set selectedTextRange(textRange)
     {
         var position = this._codeMirrorPositionFromTextRange(textRange);
+        this.focus();
         this._codeMirror.setSelection(position.start, position.end);
     }
 
@@ -520,7 +521,7 @@
         let lineHandle = this._codeMirror.getLineHandle(line);
 
         if (!textRangeToSelect) {
-            let column = Number.constrain(position.columnNumber, 0, this._codeMirror.getLine(line).length - 1);
+            let column = Number.constrain(position.columnNumber, 0, this._codeMirror.getLine(line).length);
             textRangeToSelect = new WI.TextRange(line, column, line, column);
         }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to