Ticket #1489 (closed enhancement: fixed)
Block (aka multi-line) indent
|Reported by:||dborca||Owned by:||angel_il|
|Branch state:||Votes for changeset:||committed-master|
I really liked the new feature of multi-line indent with non-persistent selections. BUT, as it is, it's cumbersome.
- Usually, I just need to quickly indent a block of code, and going into Options to turn Persistent selections off takes a lot of keypresses. So I'd rather manually indent the block of code, than changing persistent selections off and on. And I need selections. And it is easy to forget which is which. :)
- Backspace/Del? with non-persistent selections is superfluous, because there is F8 for that. With persistent selections.
- Indenting should behave EXACTLY like Tab/Backspace? will behave when used on a single, non-selected line.
Ok, so I came up with an idea, inspired from slackware-12.2/source/ap/mc/mc-4.6.1_20070623_utf8_mls_r2008-08-28.diff.gz
- I removed the persistent selection code (except the Option setting itself, because I'm lazy)
- Selections made with F3/Shift-F3 were left alone.
- Selections made with Shift + movement keys are considered "indentable", until a key other than Tab, Ctrl-Tab, Backspace, M-i or Undo is pressed. This is indicated in the status bar with an 'S' (as opposed to a 'B' for a regular selection).
- An "indentable" selection can be operated in the following ways:
- Tab will indent the block, honoring tabs, halftabs and tabs vs spaces stuff. It behaves like Tab would behave on a single, non-selected line. It maintains an "indent depth", so Undo works. Empty lines are left alone.
- BackSpace? will unindent the block. If "indent depth" (from a sequence of Tab keys) is available, it tries to unindent the block using backspace commands (behaving exacly like Tab would behave on a single, non-selected line). Otherwise it tries to unindent the block using delete commands, applied at the beginning of each line (that is, it works like implemented in 4.7.0-pre1).
- Ctrl-Tab will indent the block, always inserting (half)tabs at the beginning of the line. It works like implemented in 4.7.0-pre1 and does not honor tabs vs spaces stuff. Empty lines are left alone. Note: if used after Tab, it will reset its "indent depth" and Tab will start over at the beginning of the line.
- M-i wil indent the block, always inserting (half)tabs at the beginning of text, if any. Mostly useful when indenting code which has a mix of spaces and tabs. Empty lines are left alone. Note: if used after Tab, it will reset its "indent depth" and Tab will start over at the beginning of the line.
It's the best I could come up with to make things painless. Ideas and suggestions are welcomed. Anyway, here's the patch (against 4.7.0-pre1).
comment:13 Changed 7 years ago by angel_il
- Owner set to angel_il
- Status changed from new to accepted
- severity changed from no branch to on review
comment:17 Changed 7 years ago by andrew_b
- Votes for changeset changed from slavazanko to slavazanko andrew_b
- severity changed from on review to approved
comment:18 Changed 7 years ago by angel_il
- Status changed from accepted to testing
- Votes for changeset changed from slavazanko andrew_b to commited-master
- Resolution set to fixed
- severity changed from approved to merged