Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse won't acknowledge print margin column setting

Tags:

eclipse

In Eclipse 4.6.2, I tried to put a print margin indicator line at 80 characters using Preferences -> General -> Editors -> Text Editors -> [Checkbox] Show Print Margin. However, no matter what value I put in the Print Margin Column box, the line stays at column 120.

I'm certain the line I'm looking at is the Print Margin, because I can change its color in the same Preferences page. I've hit Apply and restarted Eclipse, but no luck.

like image 462
Soundsgoood Avatar asked Apr 04 '17 01:04

Soundsgoood


People also ask

How do I set margins in eclipse?

Go to Window/Prefences and open Java/Code Style Formatter. Then edit the profile. You can change the margin on the "Line Wrapping" tab ("Maximum line width").

How do you set print margins in Java?

setJobName(jobName); job. print(attr); j. setVisible(false); j. dispose();


1 Answers

Welcome to bug 468307, where your maximum line wrapping length is what matters.


2020-12-04:

I'm on eclipse-CDT version 2020-06 and the bug is still not fixed IMO.

  • the workaround is to modify the "Maximum line width" for your language
  • for example in C++: File --> Window --> Preferences --> C/C++ --> Code Style --> Formatter --> Edit --> Line Wrapping --> Line width and indentation levels --> click the "Maximum line width" textedit widget and modify the value to 80 or 100 or your desired value --> click "ok" (if your "ok" button is gray then read [gotcha-1] footnote)
  • other languages like Java require modifying the same "Maximum line width" but getting there might be different in the GUI

[gotcha-1] gotcha: if the "ok" button is gray then you have to edit the "Profile name:" because it does not let you override a default profile.

like image 195
nitind Avatar answered Sep 19 '22 11:09

nitind