Using Tab to indent lines

1,931 views
Skip to first unread message

Carpii

unread,
Jan 22, 2010, 6:33:13 PM1/22/10
to BBEdit Talk
If I select a block of text in BBEdit, and press Tab, it indents it
(which is what I want).

Theres an option in preferences to dictate whether this happens I
think, and obviously its enabled.

But if I select a single line of text, and hit Tab, it replaces the
whole line with a Tab character.
Is there a way to work around this, as its very inconsistent since Ive
already told BBEdit Id like Tab to indent text, not replace the
selection

Thanks
Paul

Jim Chaffin

unread,
Jan 22, 2010, 9:15:37 PM1/22/10
to bbe...@googlegroups.com
I hope not! ;-) That's a function of the OS, not BBEdit. When some text is select and you press any key, the text will be replaced with whatever that key produces. Not just in BBEdit, in every text-using app I know of.

On Jan 22, 2010, at 5:33 PM, Carpii wrote:
But if I select a single line of text, and hit Tab, it replaces the
whole line with a Tab character.
Is there a way to work around this, as its very inconsistent since Ive
already told BBEdit Id like Tab to indent text, not replace the
selection

Jim Chaffin
----------
The reason grandparents and grandchildren get along so well?
A common enemy...

Bucky Junior

unread,
Jan 23, 2010, 12:36:49 AM1/23/10
to bbe...@googlegroups.com
Yes, as Mr. Chaffin says, you are getting expected results.

I believe the default action to indent a line (selected or not) is
command-].

To reduce the level of intent, command-[.

Under the Text menu -> Shift left and right.

Bucky

Bruce Van Allen

unread,
Jan 23, 2010, 12:52:52 AM1/23/10
to bbe...@googlegroups.com

When you select a single line, be sure to select the end-of-line
character (return, linefeed, etc). Then when you press Tab
(assuming the setting you mentioned above), the line will indent
the way a block does. Otherwise, the selected portion of the
line will be replaced by the tab, as expected.

One way I make it easy to select the end-of-line character is to
enable Preferences -> Editing: General -> Allow single-click
line selection.

HTH

- Bruce

_bruce__van_allen__santa_cruz_ca_

Carpii

unread,
Jan 24, 2010, 6:38:06 PM1/24/10
to BBEdit Talk
Hi all, thanks for the responses.

On Jan 23, 2:15 am, Jim Chaffin <xairbusdri...@mac.com> wrote:
> I hope not! ;-) That's a function of the OS, not BBEdit. When some text is select and you press any key, the text will be replaced with whatever that key produces. Not just in BBEdit, in every text-using app I know of.
>

But what I mean is, this behavior seems to be customisable.
By default, if it was left to the OS: selecting some text and pressing
Tab would replace the text with a tab character. This is what happens
in TextMate, at least.

BBEdit seems to override this, at least partially, to indent a block
instead of overwriting it.
So I guess my question is not really about the underlying
technicalities of it all, but whether BBEdit could be changed to
indent a single line, instead of overwriting it.

To me its a real usability quirk :-(

Thanks
Paul

Toadling

unread,
Jan 24, 2010, 9:15:00 PM1/24/10
to bbe...@googlegroups.com
On Jan 24, 2010, at 3:38 PM, Carpii wrote:

> So I guess my question is not really about the underlying
> technicalities of it all, but whether BBEdit could be changed to
> indent a single line, instead of overwriting it.

I believe this feature already does what you're looking for. As Bruce pointed out a couple days ago, the key is to select the *entire line*, including the line ending character.

This approach feels natural to me (rather than just blindly indenting any arbitrary text selection). It also helps prevent the obvious weirdness of not being able to replace some selected text with a Tab character (although you can override the Tab-indention feature by holding down the Option key when you hit Tab, which reverses whatever you set for the preference).

As Bruce pointed out in his earlier message, an easy way to select an entire line is to also enable the "Editing: General -> Allow single-click line selection" preference setting. Then you can just click on the line numbers or on the small bit of white space to the left of a line line to select the entire line, including the line ending.

Hope this helps.

-Dennis

Reply all
Reply to author
Forward
0 new messages