texworks icon indicating copy to clipboard operation
texworks copied to clipboard

Feature Request: Make tab insert spaces

Open GoogleCodeExporter opened this issue 10 years ago • 7 comments

It would be nice to be able to make tab insert a user specified number of 
spaces instead of a fixed number of pixels.  If a user is using a monospaced 
font, then this helps a lot with alignment. Also, if we define the tabbing 
based on the number of spaces vs a fixed length, then it will adjust 
automatically when the user changes their font. 

Certainly, we should keep what we have now.  But I think this would be a nice 
addition.  

Original issue reported on code.google.com by [email protected] on 13 Aug 2010 at 6:37

GoogleCodeExporter avatar Mar 14 '15 10:03 GoogleCodeExporter

Original comment by st.loeffler on 14 Aug 2010 at 6:26

  • Added labels: Type-Enhancement
  • Removed labels: Type-Defect

GoogleCodeExporter avatar Mar 14 '15 10:03 GoogleCodeExporter

I stumbled over this post, right now. I was just so intrigued that that Tab key 
doesn't insert spaces, but a fixed pixel distance.

Shouldn't the Tab key insert either a Tab character, with a width that I could 
set (in spaces), or an actual number of spaces? For instance, I'm used to 
inserting either two or four spaces on every Tab key press.

This is actually the only editor I know of, that uses this kind of Tab key.

Original comment by [email protected] on 24 Jun 2012 at 4:35

GoogleCodeExporter avatar Mar 14 '15 10:03 GoogleCodeExporter

It does insert a Tab character, only that (as you correctly identified) it 
irritatingly renders it as a certain number of pixels instead of characters. 
That is just so wrong!

Any sane editor has options as follows:

Tab width: ___ spaces
[ ] Insert tabs as ___ spaces

Original comment by [email protected] on 26 Jun 2012 at 3:00

GoogleCodeExporter avatar Mar 14 '15 10:03 GoogleCodeExporter

But what do you do if the user does not use a fixed-width font?

FWIW, Qt only supports setting the tab width in pixel 
(http://qt-project.org/doc/qt-4.8/qtextedit.html#tabStopWidth-prop). We could 
work around this by dynamically calculating the pixel size of a representative 
character, though...

Original comment by st.loeffler on 1 Jul 2012 at 4:19

GoogleCodeExporter avatar Mar 14 '15 10:03 GoogleCodeExporter

[deleted comment]

GoogleCodeExporter avatar Mar 14 '15 10:03 GoogleCodeExporter

I was searching for this issue and ended up finding this feature request.

I think what everybody here (and I'll add myself to the list) is asking for is 
to give the option for the tab key to insert x number of spaces, instead of 
inserting a tab character.

Based on the Qt link that you posted, it seems like you might have understood 
that the request was to render the tab character as x number of spaces - but 
I'm not sure that this is what the original poster was referring to. Gedit has 
the feature in question, it's called "insert spaces instead of tabs". It seems 
like Kate (which is Qt-based) also does it: 
http://www.kate-editor.org/doc/config-dialog-editor.html

Based on that, does it sound doable?

Original comment by [email protected] on 20 Jan 2015 at 9:13

GoogleCodeExporter avatar Mar 14 '15 10:03 GoogleCodeExporter

I always use spaces instead of tabs to make formatting consistent across different environments, and so this feature would be a welcome addition for me. Currently, I have to write the spaces by hand which is quite a pain.

jurf avatar Jan 10 '21 11:01 jurf