FeaturesPluginsDocs & SupportCommunityPartners

NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

Tabbing issue with IF statements

 
Post new topic   Reply to topic    NetBeans Forums -> PHP Users
View previous topic :: View next topic  
Author Message
sketchman



Joined: 03 Jun 2009
Posts: 11

PostPosted: Wed Jun 03, 2009 7:41 pm    Post subject: Tabbing issue with IF statements Reply with quote

I've had this issue now with 6.7 and its still there with 6.7 RC 1.

Under TOOLS >OPTIONS >FORMATTING I have 'Expand Tabs to Spaces' unchecked.

When I create an IF statement with no brackets around it with a single line of code coming after, the next line won't let me tab indent to the same horizontal position of the IF.

So for example:

Code:

   if (some eval)
      my line of stuff


When I make a new line break after line 2, it starts the new line at the beginning of the text of line 2 (so at the 'm'). This is fine, but if I press SHIFT + TAB it doesn't tab me back to the 'i' in the IF statement's horizontal position, instead all the way back before it, like this.

Code:

   if (some eval)
      my line of stuff
my next line with SHIFT + TAB


The only way I can get it in the same horz position as the IF is if I make it a comment then tab it around again.

Code:

   if (some eval)
      my line of stuff
   //SHIFT then CTRL+SHIFT as a comment


The reason this is annoying is because when I'm trying to do my ELSE, I have to keep making it a comment first then removing the // to uncomment my ELSE.

So I end up doing my ELSES in two steps:

Code:

   if (some eval)
      my line of stuff
//else


then

Code:

   if (some eval)
      my line of stuff
   //else


and then...

Code:

   if (some eval)
      my line of stuff
   else


and finally I'm aligned right...

This only happens in this case that I've seen.

Thanks!
Back to top
View user's profile Send private message
Filip Zamboj
Posted via mailing list.





PostPosted: Thu Jun 04, 2009 12:32 pm    Post subject: Tabbing issue with IF statements Reply with quote

sketchman wrote:
Quote:
I've had this issue now with 6.7 and its still there with 6.7 RC 1.



Under TOOLS >OPTIONS >FORMATTING I have 'Expand Tabs to Spaces' unchecked.



When I create an IF statement with no brackets around it with a single line of code coming after, the next line won't let me tab indent to the same horizontal position of the IF.



So for example:




Code:


if (some eval)

my line of stuff







When I make a new line break after line 2, it starts the new line at the beginning of the text of line 2 (so at the 'm'). This is fine, but if I press SHIFT + TAB it doesn't tab me back to the 'i' in the IF statement's horizontal position, instead all the way back before it, like this.


http://www.netbeans.org/issues/show_bug.cgi?id=166543
Quote:


Code:


if (some eval)

my line of stuff

my next line with SHIFT + TAB



I thought it's an issue but I was told it's a feature (works as vim).

The best option for users
who don't want netbeans to make spaces it's to set up tab size and number of spaces per indent to be equal in
Tools->Options->Editor->Formatting

Let me know if that help. I tested and looks better but shift + tab goes
one tab back always and if there spaces it goes to the beginning of the
line.

basically, you have to press two tabs to have "real tab" in editor.
Otherwise you have spaces. Then you press shif+tab and it goes one tab
back == two press of tabs! (I know it looks crazy) ...

Quote:




The only way I can get it in the same horz position as the IF is if I make it a comment then tab it around again.




Code:


if (some eval)

my line of stuff

//SHIFT then CTRL+SHIFT as a comment







The reason this is annoying is because when I'm trying to do my ELSE, I have to keep making it a comment first then removing the // to uncomment my ELSE.



So I end up doing my ELSES in two steps:




Code:


if (some eval)

my line of stuff

//else



well, it's true it's annoying. You don't have to comment it, just write
else go to the beginning of the line and press tab. this should be
solved with above mentioned issue.
Quote:




then




Code:


if (some eval)

my line of stuff

//else







and then...




Code:


if (some eval)

my line of stuff

else







and finally I'm aligned right...



This only happens in this case that I've seen.



Thanks!










Back to top
sketchman



Joined: 03 Jun 2009
Posts: 11

PostPosted: Thu Jun 04, 2009 1:54 pm    Post subject: Reply with quote

Thanks for the reply and the issue report.

I changed my indent settings (have to realign a lot of code now), hopefully that will make it a bit better. I set my Number of spaces per index to 4 and my tab size to 4 and left the expand tabs to spaces unchecked. I open my code in other editors and can't use spaces or it gets broken.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> PHP Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB