Home Download Buy Blog Forum Support

Spurious tabs appearing

Spurious tabs appearing

Postby Kneehat on Thu Sep 24, 2009 6:07 pm

I noticed recently that a lot of my code has a bunch of redundant tabs at the end of the line and I was sure I didn't put them there :) I've tracked it down to a particular way of duplicating a line. (admittedly this is a bit of a bizarre way of duplicating a line but still)

Firstly, I should say I have the default settings of 'Don't replace tabs with spaces' and have tabstop set to 4.

Take a line that is tabbed in two tabs from the left-hand edge. Press <end> to go to the end of the line. Hold <shift> and press <home> so that you select everything up to the beginning of the line but not the two tabs. <Ctrl-C> to copy the line, <end><return><home> to insert a blank line below and return the cursor to the far left edge, then <ctrl-V> to paste the new line. You should see that the line appears to have two tabs at the end of it. The number of tabs at the end is identical to the number of tabs at the beginning of the copied line.
Kneehat
 
Posts: 17
Joined: Tue Aug 11, 2009 8:16 pm

Re: Spurious tabs appearing

Postby jps on Fri Sep 25, 2009 2:20 am

Yeah, this is the auto indentation at work, for better or worse.

I also end up with unwanted whitespace that was inserted by the auto indenter, and it'd be nice to have a clean way to get rid of it. Some editors delete the automatically inserted whitespace if you do anything other than typing after pressing enter, but I'm not terribly keep on this, due to it being so stateful (i.e., it would then be required to track which regions of text have been inserted due to auto indent).

Another possible option would be to automatically trim trailing whitespace on any line you edit, unless you're editing at the end of the line. Not sure if this would have some unintended consequences though.
jps
Site Admin
 
Posts: 3071
Joined: Wed Mar 19, 2008 12:33 pm

Re: Spurious tabs appearing

Postby Kneehat on Fri Sep 25, 2009 9:02 am

Ah, I see, yes that makes sense. Like I say, it is a bizarre way of working on my part and I don't usually do it, but I wanted to track down the cause.
Kneehat
 
Posts: 17
Joined: Tue Aug 11, 2009 8:16 pm

Re: Spurious tabs appearing

Postby EJ12N on Fri Sep 25, 2009 3:28 pm

I just trim all trailing space on save... I hate them >.<
EJ12N
 
Posts: 281
Joined: Tue Apr 21, 2009 5:23 pm

Re: Spurious tabs appearing

Postby Kneehat on Fri Sep 25, 2009 3:38 pm

I can't think of an unintended consequence of trimming trailing spaces/tabs from lines.... but I guess that's the nature of unintended consequences :D
Kneehat
 
Posts: 17
Joined: Tue Aug 11, 2009 8:16 pm


Return to Technical Support

Who is online

Users browsing this forum: Exabot [Bot], Google [Bot] and 23 guests