NetBeans Forums

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

Right Margin red line
Goto page 1, 2  Next
 
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Users
View previous topic :: View next topic  
Author Message
SquidWeed



Joined: 03 May 2009
Posts: 4

PostPosted: Sun May 03, 2009 1:12 am    Post subject: Right Margin red line Reply with quote

Hi, I'm new to netBeans.
I'm trying to find an answer for couple of hours,
I don't undestand what is the use of the right margin red line.
The only thing I could think of is how annoying it is

What is the use of it?
Is it removable?


tnx in advanced !
Back to top
WholeBean



Joined: 01 May 2009
Posts: 3

PostPosted: Sun May 03, 2009 8:59 am    Post subject: Reply with quote

It's there as a guide to line length.

Good style generally avoids lines longer than 80 characters,
and only 70 characters for examples intended to be used in
documentation.

The red line simply marks 80 characters wide (by default) and is a
visual guide to break long expressions over multiple lines.

You can adjust the placement of the red line in (Netbeans 6.7):
Tools > Options > Editor > Formatting.

On the left you'll see Right Margin, with a default value of 80.

If you want to remove the red line all together, you can either:

1. Increase the margin value to 160 or more; or goto
2. Tools > Options > Fonts and Colors, change the color of the Text Limit Line to white

There may be other ways, but these are the easiest ways I know of.

The Java Code Conventions can be found here
(and clause 4.1 is on page 9 of the pdf):

http://java.sun.com/docs/codeconv/CodeConventions.pdf

Hope that helps.

Regards,

Peter
Back to top
SquidWeed



Joined: 03 May 2009
Posts: 4

PostPosted: Sun May 03, 2009 10:09 pm    Post subject: Reply with quote

Making it 200 still won't make it disappear, just moving it a little bit to the right..
I still don't understand, how can I write a program with only 80 charactars per line? it's not even enough for the import statements

Thanks for replying peter!
Back to top
Peter B. West
Posted via mailing list.





PostPosted: Mon May 04, 2009 1:12 am    Post subject: Right Margin red line Reply with quote

Alternatively, merge it into the background.

Tools->Options->Fonts&Colors->Highlighting->Text Limit Line

Set the foreground color to be the same as the background.

WholeBean wrote:
Quote:
It's there as a guide to line length.



Good style generally avoids lines longer than 80 characters,

and only 70 characters for examples intended to be used in

documentation.



The red line simply marks the 80 characters point and is a

visual guide to break long declarations over multiple lines.



You can adjust the placement of the red line in Tools > Options > Formatting.



On the left you'll see "Right Margin", with a default value of 80.



If you want to remove the red line all together,

just increase the margin value to something large like 150.



The Java Code Conventions can be found here (and clause 4.1 is on page 9 of the pdf):



http://java.sun.com/docs/codeconv/CodeConventions.pdf



Hope that helps.



Regards,



Peter

--
Peter B. West <http://cv.pbw.id.au/>
Folio <http://defoe.sourceforge.net/folio/folio.html>
Back to top
SquidWeed



Joined: 03 May 2009
Posts: 4

PostPosted: Mon May 04, 2009 2:08 am    Post subject: Reply with quote

Please explain this to me,
It is better to write :

Code:

        public static void main(String[]
         args) {
      // TODO code application logic
                here
   }

rather then :
Code:

   public static void main(String[] args) {
      // TODO code application logic here
   }


It just doesn't make sense.. and it's not convenient to program like this
Back to top
WholeBean



Joined: 01 May 2009
Posts: 3

PostPosted: Mon May 04, 2009 6:52 am    Post subject: Reply with quote

The psvm statement is only 40 characters wide, so it shouldn't be up against the line limit indicator unless you are already starting it 40 characters in from the left margin, or the line limit is set to 40 characters or less.

Forty characters in is a long way to be starting your main method and would definitely make your code look strange if you then also tried to stick to the 80 character length convention.

If you have a genuine reason for starting your statements so far in from the left then I would suggest you move the line or change its color, but also look at why you are so far into the document as well.

At most you should reach 4-5 tabs in, which is only 16-20 characters from the left, leaving you plenty of room for your statements.

Especially for something like a main method, that's mostly managed at just one tab in (4 characters).

Additionally, if you also can't fit your import statements into 80 characters then there is something else going wrong.

Regards,

Peter

Regards,

Peter
Back to top
SquidWeed



Joined: 03 May 2009
Posts: 4

PostPosted: Mon May 04, 2009 12:36 pm    Post subject: Reply with quote

You right, I just noticed that the line is drawing at char 38, even though it's set to 80.
You have any idea what can cause this?
I'm using the latest netbeans on windows vista x64.
Back to top
Thomas Wolf
Posted via mailing list.





PostPosted: Mon May 04, 2009 1:48 pm    Post subject: Right Margin red line Reply with quote

I think the red line is a holdover from the days of the 80-character
terminal. If you don't like it, you can set it to the background color
as Peter suggested or simply make it much larger - I set it to 160
characters. Keeps it off my screen unless I scroll horizontally.

tom



On 05/03/2009 10:09 PM, SquidWeed wrote:
Quote:
Please explain this to me,

It is better to write :




Code:


public static void main(String[]

args) {

// TODO code application logic

here

}





rather then :


Code:


public static void main(String[] args) {

// TODO code application logic here

}







It just doesn't make sense.. and it's not convenient to program like this




Back to top
rascal



Joined: 04 Jun 2013
Posts: 1

PostPosted: Tue Jun 04, 2013 6:50 pm    Post subject: Reply with quote

Isn't the 80 character limit a holdover from the days of punched cards??

Dave
Back to top
Flanker



Joined: 25 Jun 2013
Posts: 1

PostPosted: Tue Jun 25, 2013 9:00 am    Post subject: Reply with quote

Yes, 80 is for punched cards legacy (?). But we are in 2013 and you can set Rigth Margin to 0.
Back to top
douglassguy



Joined: 03 Jun 2015
Posts: 2

PostPosted: Wed Jun 03, 2015 2:05 am    Post subject: Reply with quote

Is there an updated response on how to adjust the size and color of the Right Margin line for NetBeans IDE 8.0.2? I like the idea of the line but 80 seems just a wee too cramped, so I would like to adjust it a little further to the right and change the color. True, I can type past it, but a more accurate visual cue of where to end my lines would be helfpul. I'm using NetBeans to code in C++.

Thanks.
Back to top
tkellerer



Joined: 15 Aug 2008
Posts: 602
Location: Bavaria

PostPosted: Wed Jun 03, 2015 5:35 am    Post subject: Reply with quote

douglassguy wrote:
Is there an updated response on how to adjust the size and color of the Right Margin line for NetBeans IDE 8.0.2? I like the idea of the line but 80 seems just a wee too cramped, so I would like to adjust it a little further to the right and change the color. True, I can type past it, but a more accurate visual cue of where to end my lines would be helfpul. I'm using NetBeans to code in C++.

Thanks.


To change the value of the line, go to: Tools -> Options -> Editor -> Formatting"
Then change the value for "Right Margin" for the languages you want it changed

To change the color of the line, go to: "Tools -> Options -> Fonts & Colors -> Highlighting"
Then change the color for "Text Line Limit"
Back to top
douglassguy



Joined: 03 Jun 2015
Posts: 2

PostPosted: Mon Jun 08, 2015 5:38 am    Post subject: Reply with quote

Thanks for your help. I finally found it.

Your instructions were just a little off.

I had followed your instructions regarding the change of depth for the right margin, selecting C++ as the language in which I wanted the change to occur. I even selected the category of Tabs and Indents. The Right Margin option is not to be found this way no matter what category is selected.

I discovered that after navigating through Tools > Options > Editor > Formatting as suggested, one must also change the Language option to one of the following: All Languages, Fortran, HTML, JSON or JavaScript. Under these categories the option to adjust the Right Margin line becomes available. All Languages will set the depth of the Right Margin for C, C++ and C/C++ Header. The other languages have an additional option these three don't. The other languages can be set to use the All Languages depth or each of these other languages can be set to have its own unique Right Margin depth.

Again, thanks for pointing me in the right direction.
Back to top
Robin-Whittle



Joined: 20 Feb 2014
Posts: 6

PostPosted: Wed Jul 01, 2015 10:48 am    Post subject: Reply with quote

Hi douglassguy,

Thanks very much for pointing out how to set the right margin indicator (AKA Text Limit Line) column number in Nebeans 8.0.2. I looked everywhere, with C++ selected. Googling NetBeans "right margin" returns this discussion as number one out of 13,000 results. Salute!

- Robin
Back to top
geertjan



Joined: 22 Jan 2014
Posts: 447

PostPosted: Wed Jul 01, 2015 9:02 pm    Post subject: Right Margin red line Reply with quote

See the screenshot attached.

Gj

On 1-7-2015 12:48, Robin-Whittle wrote:
Quote:
Hi douglassguy,

Thanks very much for pointing out how to set the right margin indicator (AKA Text Limit Line) column number in Nebeans 8.0.2. I looked everywhere, with C++ selected. Googling NetBeans "right margin" returns this discussion as number one out of 13,000 results. Salute!

- Robin







right-margin.png
 Description:
 Filesize:  39.27 KB
 Viewed:  1426 Time(s)

right-margin.png


Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Users All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
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 cannot attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo