Skip to content

Display line numbers for the file in the editor #1648

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from Nov 4, 2013
Merged

Display line numbers for the file in the editor #1648

merged 3 commits into from Nov 4, 2013

Conversation

ghost
Copy link

@ghost ghost commented Oct 28, 2013

image

Adds a JTextPanel to the left of the TextAreaPainter in the JEditTextArea.

Stores this in a new "LEFT" component of the JEditTextArea's ScrollLayout.

The new line number component only updates and repaints when one of the parameters changes (the displayed line numbers of the panel width (which is based on the display width of the maximum number).

The line number panel may update whenever the updateScrollBars() or painter.repaint() methods are called.

This completes issue #1502.

@ghost ghost mentioned this pull request Oct 28, 2013
@cmaglie
Copy link
Member

cmaglie commented Oct 28, 2013

Great patch!

May I ask you if its possible to add an option in the preferences to enable/disable the line numbering?

C

@ghost
Copy link
Author

ghost commented Oct 28, 2013

Absolutely! :) This is still open too, right?
#976 Add option to go to a line number in the IDE [imported]

@damellis
Copy link
Contributor

Can we disable this by default? So the IDE looks the same when you upgrade, but people can turn the line numbers on if they want to?

@ghost
Copy link
Author

ghost commented Oct 28, 2013

Absolutely. I shall return :)

@cmaglie
Copy link
Member

cmaglie commented Oct 28, 2013

@cayci, yes #976 is still open.

@ghost
Copy link
Author

ghost commented Oct 28, 2013

To introduce myself -
My name is Cayci. I am a newbie in Charleston, SC. I love Arduino, and I was inspired to contribute while at All Things Open, an open source conference in Raleigh, NC. I am also a member of MakeLab in Charleston.
I hope to meet many of you at conferences and meetups! :)

add preference to enable/disable line numbers and make font change work
@ghost
Copy link
Author

ghost commented Oct 29, 2013

Line numbers are disabled by default. If the user prefers to display line numbers, he should go to file, preferences, and check the corresponding box.

@Lauszus
Copy link
Contributor

Lauszus commented Oct 29, 2013

It does not work correctly on Mac OS X 10.8. It looks like it does not stretch the line numbers correctly.
See the screenshot below:
arduino line numbers

Except for that I think it looks great ;)

@ghost
Copy link
Author

ghost commented Oct 29, 2013

Thank you! I will work on this in a few days. I need to get a grant application in first :)

Fix the line number font rendering problem on the Mac.

Now, the TextAreaLineNumbers class extends the TextAreaPainter and just
overloads the paintLine method to make it render the line number instead
of rendering the whole line. Other than that, the superclass' drawing
code is used.

So: the same drawing code that renders the source code text in the
editor is now also being used to render the line numbers.
@ghost
Copy link
Author

ghost commented Nov 3, 2013

I switched it so the same drawing code that renders the source code text in the editor is now also being used to render the line numbers. This should fix the Mac font rendering issue that Lauszus pointed out.

@cmaglie
Copy link
Member

cmaglie commented Nov 3, 2013

Works for me. Lauszus?

C

@Lauszus
Copy link
Contributor

Lauszus commented Nov 3, 2013

It works here as well. Great work @cayci!

@ghost
Copy link
Author

ghost commented Nov 3, 2013

Thank you! Are you able to merge this enhancement, or will it need to wait
for the next release? :)

On Sun, Nov 3, 2013 at 4:17 PM, Kristian Sloth Lauszus <
[email protected]> wrote:

It works here as well. Great work @cayci https://github.com/cayci!


Reply to this email directly or view it on GitHubhttps://github.com//pull/1648#issuecomment-27654613
.

@cmaglie cmaglie merged commit 66faf5d into arduino:master Nov 4, 2013
@cmaglie
Copy link
Member

cmaglie commented Nov 4, 2013

Merged, it will be available with the next IDE release 1.5.5.
Thank you!
C

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants