Changeset 237232 in webkit


Ignore:
Timestamp:
Oct 17, 2018 12:46:54 PM (5 years ago)
Author:
Devin Rousso
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.

Location:
trunk/Source/WebInspectorUI
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r237212 r237232  
     12018-10-17  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: Quickly Open to line/column does should have caret indicating where the position is
     4        https://bugs.webkit.org/show_bug.cgi?id=190643
     5
     6        Reviewed by Matt Baker.
     7
     8        * UserInterface/Views/TextEditor.js:
     9        (WI.TextEditor.prototype.set selectedTextRange):
     10        (WI.TextEditor.prototype.revealPosition):
     11        Ensure that CodeMirror is focused before attempting to `setSelection`.
     12        Drive-by: allow selections past the "end" of the line (since there is a `\n` or `\r`).
     13
     14        * UserInterface/Views/SourceCodeTextEditor.js:
     15        (WI.SourceCodeTextEditor.prototype.dialogWasDismissedWithRepresentedObject):
     16        Remove the extra `focus` call after dismissing the `WI.GoToLineDialog` since it is now
     17        handled by `WI.TextEditor` via `revealPosition`.
     18
    1192018-10-16  Joseph Pecoraro  <pecoraro@apple.com>
    220
  • trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js

    r237212 r237232  
    280280        let position = new WI.SourceCodePosition(lineNumber - 1, 0);
    281281        let range = new WI.TextRange(lineNumber - 1, 0, lineNumber, 0);
    282 
    283282        this.revealPosition(position, range, false, true);
    284         this.focus();
    285283    }
    286284
  • trunk/Source/WebInspectorUI/UserInterface/Views/TextEditor.js

    r237145 r237232  
    229229    {
    230230        var position = this._codeMirrorPositionFromTextRange(textRange);
     231        this.focus();
    231232        this._codeMirror.setSelection(position.start, position.end);
    232233    }
     
    521522
    522523        if (!textRangeToSelect) {
    523             let column = Number.constrain(position.columnNumber, 0, this._codeMirror.getLine(line).length - 1);
     524            let column = Number.constrain(position.columnNumber, 0, this._codeMirror.getLine(line).length);
    524525            textRangeToSelect = new WI.TextRange(line, column, line, column);
    525526        }
Note: See TracChangeset for help on using the changeset viewer.