[Qt-creator] Change keys for indent/unindent lines

Leandro T. C. Melo leandro.melo at nokia.com
Thu Mar 17 10:20:02 CET 2011


On 3/16/2011 3:35 PM, ext Stephen Chu wrote:
> I stumbled into tab/shift-tab with selection to indent/unindent lines of
> text. They add/remove leading tabs to selected lines. I had this
> function in other IDEs I used and find it extremely useful.
>
> One issue I have is the use of tab key for this. Sometimes I will select
> some text and hit tab to replace the text with a tab. Instead of doing
> that, the editor adds a tab to the beginning of the line, leaving my
> selection intact.
>

Hi.

This seems to be the default behavior in IDEs like Visual Studio, 
Eclipse, CodeBlocks, and NetBeans. However, I noticed a variation for 
the case in which the selection is only within a single line. 
Coincidentally, yesterday I merged into master a request (#252) that is 
related to that.

Considering the tools mentioned above, whenever the selection contains 
multiple-lines the code is indented (just like Creator already does). 
For the one line selection, excepting for NetBeans, all others by 
default will replace the selected content with a tab, as you describe. 
But in Eclipse I found an interesting behavior: It will only indent the 
single line if the selection covers the entire line.  Otherwise, it will 
replace it by a tab.

Since yesterday, Creator handles the single line selection case just 
like Eclipse. I tried looking into other IDEs/editors to check for a 
"common" way of handling this... I hope the approach is satisfying, but 
if not, we can re-evaluate. But at first, I don't think that creating a 
option for that would be necessary.

Cheers,
Leandro.

-- 
Leandro T. C. Melo
Software Engineer
Nokia, Qt Development Frameworks

Nokia gate5 GmbH
Firmensitz: Invalidenstr. 117, 10115 Berlin, Germany
Registergericht: Amtsgericht Charlottenburg, Berlin: HRB 106443B
Umsatzsteueridentifikationsnummer: DE 812 845 193
Geschäftsführer: Dr. Michael Halbherr, Karim Tähtivuori




More information about the Qt-creator-old mailing list