#936 Dedent works unexpectedly with block-selection

Scintilla (356)

Repro'ed with Scite 225:

Suppose you have 4 lines, indented by 8 spaces under a line like "if (1) {"
each with 'abcd;

Turn on view-whitespace

Block-select the 'b' on all 4 lines.

Press a tab. This replaces the 'b' with three spaces (4-space tabs).

Now press shift-tab. We expect this to undo the tab operation, but
it instead shifts the 4 lines by 1 tab-width, and moves the block selection
4 spaces to the left. Once the cursor is to the left of all lines of text,
it now dedents the lines, but it keeps the gap that was inserted by
pressing 'tab' in block-select mode.

See Komodo bug report http://bugs.activestate.com/show_bug.cgi?id=93993


  • Neil Hodgson

    Neil Hodgson - 2012-05-07

    Tab and Shift+Tab are not exact inverses. I don't understand why block selection is included in the description. How is this different from the single line case: " abcd;", select "b", press Tab, press Shift+Tab?

  • Neil Hodgson

    Neil Hodgson - 2012-05-07
    • assigned_to: nobody --> nyamatongwe
    • labels: --> Scintilla
  • Eric Promislow

    Eric Promislow - 2012-05-07
    • status: open --> closed
  • Eric Promislow

    Eric Promislow - 2012-05-07

    The Komodo implementation differs from Scite's when shift-tab is pressed. In Scite shift-tab always
    dedents the full line. In Komodo it dedents the line if the cursor is in the line's leading white-space.
    Otherwise it deletes a tab-stop's worth of spaces (or a tab) to the left of the cursor. If it's inside
    a line and directly to the right of white-space, it does nothing. That's only the case when there's
    no selection. When more than one line is selected it always dedents. When the selection is
    constrained to a single line, the behavior is more irregular (meaning I haven't looked at the code yet).

    It would seem to me that when every left-edge in a block selection BS is immediately to the left of
    white-space, min(WS(line) for each line in BS) should be consumed, where WS(line) is the amount
    of white-space characters to the left of the line's caret, up to the current tab-width. At least that would
    be more consistent for Komodo users. And I'm not yet sure how this would work with proportional fonts.


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks