David Kaczynski
David Kaczynski

Reputation: 1255

How to display characters per line in Eclipse

Is there an option in Eclipse or CDT to display the number of characters in each line of code or to highlight lines of code that exceed a specific length?

I am programming in C on Eclipse 3.7

Upvotes: 1

Views: 2936

Answers (2)

Sham Fiorin
Sham Fiorin

Reputation: 539

In Eclipse, on the bottom bar of the IDE, there is a number like: 1:1, 19:20, 50:100... this means that "line:charactersInLine".

To complement not exceed too much the number of characters in line is a good practice. I'm the old days programming with very little monitors on resolution with 800x600, the number of 80 characters was a good one. But now with widescreen monitors a good number of characters in accord with many programmers is 120 characters per line.

Complementing the answer of @David Kaczynski:

I found it. Go to Windows -> Preferences. Select Text Editors in the dialog box, and check the "Show print margin" option. This will display a marker at a given column number that can allow the author to avoid exceeding a specific line length.

After you activated Show print margin that shows the count of the lines, you can configure to:

Print margin column: 120

Upvotes: 0

David Kaczynski
David Kaczynski

Reputation: 1255

I found it. Go to Windows -> Preferences. Select Text Editors in the dialog box, and check the "Show print margin" option. This will display a marker at a given column number that can allow the author to avoid exceeding a specific line length.

Upvotes: 2

Related Questions