Changeset 112053 in webkit


Ignore:
Timestamp:
Mar 25, 2012 11:17:48 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

Web Inspector: Indenting fully selected line should not indent the line next to it
https://bugs.webkit.org/show_bug.cgi?id=81758

Source/WebCore:

In the editor, you can select a whole line by moving caret at 0 column
position and pressing Shift + Arrow Down/Up. After that, pressing Tab
indents 2 lines: fully selected one and the line next to it. The patch
changes this behaviour to indent only fully selected line since that is
what pretty-match all the other code editors do.

Patch by Nikita Vasilyev <me@elv1s.ru> on 2012-03-25
Reviewed by Pavel Feldman.

Test: inspector/editor/indentation.html

  • inspector/front-end/TextViewer.js:

(WebInspector.TextEditorMainPanel.prototype._indentLines):

Do not insert indent at the begging of the last line if a selection
ends on its 0 column.

(WebInspector.TextEditorMainPanel.prototype._unindentLines):

Do not remove indent at the begging of the last line if a selection
ends on its 0 column.

LayoutTests:

Patch by Nikita Vasilyev <me@elv1s.ru> on 2012-03-25
Reviewed by Pavel Feldman.

  • inspector/editor/indentation-expected.txt: Added.
  • inspector/editor/indentation.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r112052 r112053  
     12012-03-25  Nikita Vasilyev  <me@elv1s.ru>
     2
     3        Web Inspector: Indenting fully selected line should not indent the line next to it
     4        https://bugs.webkit.org/show_bug.cgi?id=81758
     5
     6        Reviewed by Pavel Feldman.
     7
     8        * inspector/editor/indentation-expected.txt: Added.
     9        * inspector/editor/indentation.html: Added.
     10
    1112012-03-25  Csaba Osztrogonác  <ossy@webkit.org>
    212
  • trunk/Source/WebCore/ChangeLog

    r112051 r112053  
     12012-03-25  Nikita Vasilyev  <me@elv1s.ru>
     2
     3        Web Inspector: Indenting fully selected line should not indent the line next to it
     4        https://bugs.webkit.org/show_bug.cgi?id=81758
     5
     6        In the editor, you can select a whole line by moving caret at 0 column
     7        position and pressing Shift + Arrow Down/Up. After that, pressing Tab
     8        indents 2 lines: fully selected one and the line next to it. The patch
     9        changes this behaviour to indent only fully selected line since that is
     10        what pretty-match all the other code editors do.
     11
     12        Reviewed by Pavel Feldman.
     13
     14        Test: inspector/editor/indentation.html
     15
     16        * inspector/front-end/TextViewer.js:
     17        (WebInspector.TextEditorMainPanel.prototype._indentLines):
     18            Do not insert indent at the begging of the last line if a selection
     19            ends on its 0 column.
     20        (WebInspector.TextEditorMainPanel.prototype._unindentLines):
     21            Do not remove indent at the begging of the last line if a selection
     22            ends on its 0 column.
     23
    1242012-03-25  Abhishek Arya  <inferno@chromium.org>
    225
  • trunk/Source/WebCore/inspector/front-end/TextViewer.js

    r111743 r112053  
    11271127            this._textModel.markUndoableState();
    11281128
    1129         for (var lineNumber = range.startLine; lineNumber <= range.endLine; lineNumber++)
     1129        var newRange = range.clone();
     1130
     1131        // Do not change a selection start position when it is at the beginning of a line
     1132        if (range.startColumn)
     1133            newRange.startColumn += indent.length;
     1134
     1135        var indentEndLine = range.endLine;
     1136        if (range.endColumn)
     1137            newRange.endColumn += indent.length;
     1138        else
     1139            indentEndLine--;
     1140
     1141        for (var lineNumber = range.startLine; lineNumber <= indentEndLine; lineNumber++)
    11301142            this._textModel.setText(new WebInspector.TextRange(lineNumber, 0, lineNumber, 0), indent);
    11311143
    1132         var newRange = range.clone();
    1133         newRange.startColumn += indent.length;
    1134         newRange.endColumn += indent.length;
    11351144        this._lastEditedRange = newRange;
    11361145
     
    11481157        var newRange = range.clone();
    11491158
    1150         for (var lineNumber = range.startLine; lineNumber <= range.endLine; lineNumber++) {
     1159        var indentEndLine = range.endLine;
     1160        if (!range.endColumn)
     1161            indentEndLine--;
     1162
     1163        for (var lineNumber = range.startLine; lineNumber <= indentEndLine; lineNumber++) {
    11511164            var line = this._textModel.line(lineNumber);
    11521165            var firstCharacter = line.charAt(0);
Note: See TracChangeset for help on using the changeset viewer.