[Midnight Commander] #1489: Block (aka multi-line) indent

693 views
Skip to first unread message

Ticket System

unread,
Aug 6, 2009, 7:37:35 PM8/6/09
to dbo...@yahoo.com, mc-...@googlegroups.com
#1489: Block (aka multi-line) indent
-------------------------+--------------------------------------------------
Reporter: dborca | Owner:
Type: enhancement | Status: new
Priority: major | Milestone: 4.7.0-pre2
Component: mcedit | Version: 4.7.0-pre1
Severity: no branch | Keywords:
Votes: | Blocking:
Blockedby: |
-------------------------+--------------------------------------------------
I really liked the new feature of multi-line indent with non-persistent
selections. BUT, as it is, it's cumbersome.

1. 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. :)

2. Backspace/Del with non-persistent selections is superfluous, because
there is F8 for that. With persistent selections.

3. 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

1. I removed the persistent selection code (except the Option setting
itself, because I'm lazy)

2. Selections made with F3/Shift-F3 were left alone.

3. 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).

4. An "indentable" selection can be operated in the following ways:
a. 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.
b. 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).
c. 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.
d. 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).

--
Ticket URL: <www.midnight-commander.org/ticket/1489>
Midnight Commander <www.midnight-commander.org>
Midnight Development Center

Ticket System

unread,
Aug 6, 2009, 7:59:07 PM8/6/09
to dbo...@yahoo.com, mc-...@googlegroups.com
#1489: Block (aka multi-line) indent
-------------------------+--------------------------------------------------
Reporter: dborca | Owner:
Type: enhancement | Status: new
Priority: major | Milestone: 4.7.0-pre2
Component: mcedit | Version: 4.7.0-pre1
Severity: no branch | Resolution:
Keywords: | Votes:
Blocking: | Blockedby:
-------------------------+--------------------------------------------------
Changes (by dborca):

* cc: dbo...@yahoo.com (added)


--
Ticket URL: <www.midnight-commander.org/ticket/1489#comment:1>

Ticket System

unread,
Aug 7, 2009, 2:37:11 AM8/7/09
to dbo...@yahoo.com, mc-...@googlegroups.com
#1489: Block (aka multi-line) indent
-------------------------+--------------------------------------------------
Reporter: dborca | Owner:
Type: enhancement | Status: new
Priority: major | Milestone: 4.7.0-pre2
Component: mcedit | Version: 4.7.0-pre1
Severity: no branch | Resolution:
Keywords: | Votes:
Blocking: | Blockedby:
-------------------------+--------------------------------------------------

Comment(by angel_il):

>1. 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.

just turn Persistent selections off :) and newer turn on :)

--
Ticket URL: <www.midnight-commander.org/ticket/1489#comment:2>

Ticket System

unread,
Aug 7, 2009, 2:39:35 AM8/7/09
to dbo...@yahoo.com, mc-...@googlegroups.com
#1489: Block (aka multi-line) indent
-------------------------+--------------------------------------------------
Reporter: dborca | Owner:
Type: enhancement | Status: new
Priority: major | Milestone: 4.7.0-pre2
Component: mcedit | Version: 4.7.0-pre1
Severity: no branch | Resolution:
Keywords: | Votes:
Blocking: | Blockedby:
-------------------------+--------------------------------------------------

Comment(by angel_il):

>2. Backspace/Del with non-persistent selections is superfluous, because
there is F8 for that. With persistent selections.

its (BS/Del - delete selected text) the actual standard for many editors.

--
Ticket URL: <www.midnight-commander.org/ticket/1489#comment:3>

Ticket System

unread,
Aug 7, 2009, 2:49:19 AM8/7/09
to dbo...@yahoo.com, mc-...@googlegroups.com
#1489: Block (aka multi-line) indent
-------------------------+--------------------------------------------------
Reporter: dborca | Owner:
Type: enhancement | Status: new
Priority: major | Milestone: 4.7.0-pre2
Component: mcedit | Version: 4.7.0-pre1
Severity: no branch | Resolution:
Keywords: | Votes:
Blocking: | Blockedby:
-------------------------+--------------------------------------------------

Comment(by angel_il):

>3. Indenting should behave EXACTLY like Tab/Backspace will behave when
used on a single, non-selected line.

but Tab/Backspace on a single, non-selected line work as tab / backspace
tab - insert <tab>, backspace - delete 1 char.

Or what do you mean?

--
Ticket URL: <www.midnight-commander.org/ticket/1489#comment:4>

Ticket System

unread,
Aug 7, 2009, 3:04:23 AM8/7/09
to dbo...@yahoo.com, mc-...@googlegroups.com
#1489: Block (aka multi-line) indent
-------------------------+--------------------------------------------------
Reporter: dborca | Owner:
Type: enhancement | Status: new
Priority: major | Milestone: 4.7.0-pre2
Component: mcedit | Version: 4.7.0-pre1
Severity: no branch | Resolution:
Keywords: | Votes:
Blocking: | Blockedby:
-------------------------+--------------------------------------------------

Comment(by angel_il):

>b. BackSpace will unindent the block.

will be after #212 just re-define BackSpace

--
Ticket URL: <www.midnight-commander.org/ticket/1489#comment:5>

Ticket System

unread,
Aug 7, 2009, 3:06:40 AM8/7/09
to dbo...@yahoo.com, mc-...@googlegroups.com
#1489: Block (aka multi-line) indent
-------------------------+--------------------------------------------------
Reporter: dborca | Owner:
Type: enhancement | Status: new
Priority: major | Milestone: 4.7.0-pre2
Component: mcedit | Version: 4.7.0-pre1
Severity: no branch | Resolution:
Keywords: | Votes:
Blocking: | Blockedby:
-------------------------+--------------------------------------------------

Comment(by angel_il):

>c. Ctrl-Tab will indent the block

we can not use Ctrl-Tab, many terminals not sent esc-seq on this hotkey.

--
Ticket URL: <www.midnight-commander.org/ticket/1489#comment:6>

Ticket System

unread,
Aug 7, 2009, 8:59:32 AM8/7/09
to dbo...@yahoo.com, mc-...@googlegroups.com
#1489: Block (aka multi-line) indent
-------------------------+--------------------------------------------------
Reporter: dborca | Owner:
Type: enhancement | Status: new
Priority: major | Milestone: 4.7.0-pre2
Component: mcedit | Version: 4.7.0-pre1
Severity: no branch | Resolution:
Keywords: | Votes:
Blocking: | Blockedby:
-------------------------+--------------------------------------------------

Comment(by dborca):

Replying to [comment:2 angel_il]:

> >1. 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.
>

> just turn Persistent selections off :) and newer turn on :)

And then do what with them? Besides indenting, they're useless.

--
Ticket URL: <www.midnight-commander.org/ticket/1489#comment:7>

Ticket System

unread,
Aug 7, 2009, 9:08:16 AM8/7/09
to dbo...@yahoo.com, mc-...@googlegroups.com
#1489: Block (aka multi-line) indent
-------------------------+--------------------------------------------------
Reporter: dborca | Owner:
Type: enhancement | Status: new
Priority: major | Milestone: 4.7.0-pre2
Component: mcedit | Version: 4.7.0-pre1
Severity: no branch | Resolution:
Keywords: | Votes:
Blocking: | Blockedby:
-------------------------+--------------------------------------------------

Comment(by dborca):

Replying to [comment:3 angel_il]:

> >2. Backspace/Del with non-persistent selections is superfluous, because
there is F8 for that. With persistent selections.
>

> its (BS/Del - delete selected text) the actual standard for many
editors.

Well, for mcedit, F8 is the de facto standard, for many, many, many years
now. Users of mc won't complain about that.

About BackSpace, you are right. I was under the wrong impression. Sorry.
But let's take an example: Visual Studio 2008... no wait! that's evil...
SciTe/Scintilla uses Alt-Backspace for block unindenting. Hmm... that key
is taken for Kill Back Word.

--
Ticket URL: <www.midnight-commander.org/ticket/1489#comment:8>

Ticket System

unread,
Aug 7, 2009, 9:12:13 AM8/7/09
to dbo...@yahoo.com, mc-...@googlegroups.com
#1489: Block (aka multi-line) indent
-------------------------+--------------------------------------------------
Reporter: dborca | Owner:
Type: enhancement | Status: new
Priority: major | Milestone: 4.7.0-pre2
Component: mcedit | Version: 4.7.0-pre1
Severity: no branch | Resolution:
Keywords: | Votes:
Blocking: | Blockedby:
-------------------------+--------------------------------------------------

Comment(by dborca):

Replying to [comment:4 angel_il]:

> >3. Indenting should behave EXACTLY like Tab/Backspace will behave when
used on a single, non-selected line.
>

> but Tab/Backspace on a single, non-selected line work as tab / backspace
> tab - insert <tab>, backspace - delete 1 char.
>
> Or what do you mean?

Not if you have the default configuration:
[x] Fake half tabs
[ ] Backspace through tabs
[ ] Fill tabs with spaces
Tab spacing: 8

Step0:
text

Step1: hit Tab
text

Step2: hit Tab
<------>text

Step3: hit Tab
<------> text

Step4: hit Backspace
<------>text

Step5: hit Backspace
text

I think you get the idea.

--
Ticket URL: <www.midnight-commander.org/ticket/1489#comment:9>

Ticket System

unread,
Aug 7, 2009, 9:17:17 AM8/7/09
to dbo...@yahoo.com, mc-...@googlegroups.com
#1489: Block (aka multi-line) indent
-------------------------+--------------------------------------------------
Reporter: dborca | Owner:
Type: enhancement | Status: new
Priority: major | Milestone: 4.7.0-pre2
Component: mcedit | Version: 4.7.0-pre1
Severity: no branch | Resolution:
Keywords: | Votes:
Blocking: | Blockedby:
-------------------------+--------------------------------------------------

Comment(by dborca):

Replying to [comment:6 angel_il]:

> >c. Ctrl-Tab will indent the block
> we can not use Ctrl-Tab, many terminals not sent esc-seq on this hotkey.

Ok, then we have to find another suggestive hotkey. They become
increasincly scarce :(
Ctrl-Tab/Ctrl-I and Shift-Tab is replaced by src/key.c#correct_key_code()
to KEY_BTAB
Does Ctrl-I/Shift-Tab work on the aforementioned terminals?

PS: sorry about the previous post. I should've used monospace.

--
Ticket URL: <www.midnight-commander.org/ticket/1489#comment:10>

Ticket System

unread,
Aug 12, 2009, 4:09:45 PM8/12/09
to dbo...@yahoo.com, mc-...@googlegroups.com
#1489: Block (aka multi-line) indent
-------------------------+--------------------------------------------------
Reporter: dborca | Owner:
Type: enhancement | Status: new
Priority: major | Milestone: 4.7.0-pre3
Component: mcedit | Version: 4.7.0-pre1
Severity: no branch | Resolution:
Keywords: | Votes:
Blocking: | Blockedby:
-------------------------+--------------------------------------------------
Changes (by angel_il):

* milestone: 4.7.0-pre2 => 4.7.0-pre3


--
Ticket URL: <www.midnight-commander.org/ticket/1489#comment:11>

Ticket System

unread,
Sep 22, 2009, 6:58:39 AM9/22/09
to dbo...@yahoo.com, mc-...@googlegroups.com
#1489: Block (aka multi-line) indent
-------------------------+--------------------------------------------------
Reporter: dborca | Owner:
Type: enhancement | Status: new
Priority: major | Milestone: 4.7.0-pre4
Component: mcedit | Version: 4.7.0-pre1
Severity: no branch | Resolution:
Keywords: | Votes:
Blocking: | Blockedby:
-------------------------+--------------------------------------------------
Changes (by angel_il):

* milestone: 4.7.0-pre3 => 4.7.0-pre4


--
Ticket URL: <www.midnight-commander.org/ticket/1489#comment:12>

Ticket System

unread,
Oct 28, 2009, 7:48:47 AM10/28/09
to dbo...@yahoo.com, il.s...@gmail.com, mc-...@googlegroups.com
#1489: Block (aka multi-line) indent
-------------------------+--------------------------------------------------
Reporter: dborca | Owner: angel_il
Type: enhancement | Status: accepted
Priority: major | Milestone: 4.7.0-pre4
Component: mcedit | Version: 4.7.0-pre1
Severity: on review | Resolution:
Keywords: | Votes:
Blocking: | Blockedby:
-------------------------+--------------------------------------------------
Changes (by angel_il):

* owner: => angel_il
* status: new => accepted
* severity: no branch => on review


Comment:

branch: 1489_block_indent (parent: master)
changeset: 3de45b9b85a43215d5331276fa5e4628d9427009

--
Ticket URL: <www.midnight-commander.org/ticket/1489#comment:13>

Ticket System

unread,
Oct 28, 2009, 8:47:47 AM10/28/09
to dbo...@yahoo.com, il.s...@gmail.com, mc-...@googlegroups.com
#1489: Block (aka multi-line) indent
-------------------------+--------------------------------------------------
Reporter: dborca | Owner: angel_il
Type: enhancement | Status: accepted
Priority: major | Milestone: 4.7.0-pre4
Component: mcedit | Version: 4.7.0-pre1
Severity: on review | Resolution:
Keywords: | Votes:
Blocking: | Blockedby:
-------------------------+--------------------------------------------------

Comment(by angel_il):

changeset: 18a183fbd41d428ad7eb6d9492c525288925053b (force update)

--
Ticket URL: <www.midnight-commander.org/ticket/1489#comment:14>

Ticket System

unread,
Oct 28, 2009, 5:56:16 PM10/28/09
to dbo...@yahoo.com, il.s...@gmail.com, mc-...@googlegroups.com
#1489: Block (aka multi-line) indent
-------------------------+--------------------------------------------------
Reporter: dborca | Owner: angel_il
Type: enhancement | Status: accepted
Priority: major | Milestone: 4.7.0-pre4
Component: mcedit | Version: 4.7.0-pre1
Severity: on review | Resolution:
Keywords: | Votes: slavazanko
Blocking: | Blockedby:
-------------------------+--------------------------------------------------
Changes (by slavazanko):

* votes: => slavazanko


--
Ticket URL: <www.midnight-commander.org/ticket/1489#comment:15>

Ticket System

unread,
Oct 29, 2009, 2:55:29 AM10/29/09
to dbo...@yahoo.com, il.s...@gmail.com, mc-...@googlegroups.com
#1489: Block (aka multi-line) indent
-------------------------+--------------------------------------------------
Reporter: dborca | Owner: angel_il
Type: enhancement | Status: accepted
Priority: major | Milestone: 4.7.0-pre4
Component: mcedit | Version: 4.7.0-pre1
Severity: on review | Resolution:
Keywords: | Votes: slavazanko
Blocking: | Blockedby:
-------------------------+--------------------------------------------------

Comment(by angel_il):

118ee1487a7cb01c35a83255f7ce46f07050e27c (force update)

--
Ticket URL: <www.midnight-commander.org/ticket/1489#comment:16>

Ticket System

unread,
Oct 29, 2009, 3:47:25 AM10/29/09
to dbo...@yahoo.com, il.s...@gmail.com, mc-...@googlegroups.com
#1489: Block (aka multi-line) indent
-------------------------+--------------------------------------------------
Reporter: dborca | Owner: angel_il
Type: enhancement | Status: accepted
Priority: major | Milestone: 4.7.0-pre4
Component: mcedit | Version: 4.7.0-pre1
Severity: approved | Resolution:
Keywords: | Votes: slavazanko andrew_b
Blocking: | Blockedby:
-------------------------+--------------------------------------------------
Changes (by andrew_b):

* votes: slavazanko => slavazanko andrew_b
* severity: on review => approved


--
Ticket URL: <www.midnight-commander.org/ticket/1489#comment:17>

Ticket System

unread,
Oct 29, 2009, 3:57:58 AM10/29/09
to dbo...@yahoo.com, il.s...@gmail.com, mc-...@googlegroups.com
#1489: Block (aka multi-line) indent
-------------------------+--------------------------------------------------
Reporter: dborca | Owner: angel_il
Type: enhancement | Status: testing
Priority: major | Milestone: 4.7.0-pre4
Component: mcedit | Version: 4.7.0-pre1
Severity: merged | Resolution: fixed
Keywords: | Votes: commited-master
Blocking: | Blockedby:
-------------------------+--------------------------------------------------
Changes (by angel_il):

* status: accepted => testing
* votes: slavazanko andrew_b => commited-master
* resolution: => fixed
* severity: approved => merged


Comment:

Fixed: 359c9406d10f7298318090f834a573d0a5f0e29a

--
Ticket URL: <www.midnight-commander.org/ticket/1489#comment:18>

Ticket System

unread,
Oct 29, 2009, 3:58:08 AM10/29/09
to dbo...@yahoo.com, il.s...@gmail.com, mc-...@googlegroups.com
#1489: Block (aka multi-line) indent
-------------------------+--------------------------------------------------
Reporter: dborca | Owner: angel_il
Type: enhancement | Status: closed
Priority: major | Milestone: 4.7.0-pre4
Component: mcedit | Version: 4.7.0-pre1
Severity: merged | Resolution: fixed
Keywords: | Votes: commited-master
Blocking: | Blockedby:
-------------------------+--------------------------------------------------
Changes (by angel_il):

* status: testing => closed


--
Ticket URL: <www.midnight-commander.org/ticket/1489#comment:19>

Ticket System

unread,
Feb 20, 2010, 7:54:05 PM2/20/10
to dbo...@yahoo.com, il.s...@gmail.com, mc-...@googlegroups.com
#1489: Block (aka multi-line) indent
-------------------------+--------------------------------------------------
Reporter: dborca | Owner: angel_il
Type: enhancement | Status: closed
Priority: major | Milestone: 4.7.0-pre4
Component: mcedit | Version: 4.7.0-pre1
Severity: merged | Resolution: fixed
Keywords: | Votes: commited-master
Blocking: | Blockedby:
-------------------------+--------------------------------------------------

Comment(by zero):

[http://DECORATION-STAIR.INFO decoration]
Changed 1 year ago by admin

[http://SUPER-SALE-BATHTUB.INFO bathtub]
Changed 1 year ago by admin

[http://CHEAP-SOLAR-SYSTEM.INFO solar system]
Changed 1 year ago by admin

[http://CHEAP-STAIR-PARTS.INFO stair parts]
Changed 1 year ago by admin

[http://CHINA-SOLAR-SUPPLY.INFO solar supply]
Changed 1 year ago by admin

--
Ticket URL: <www.midnight-commander.org/ticket/1489#comment:20>

Reply all
Reply to author
Forward
0 new messages