Skip to content

Line Numbers #7536

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions app/src/processing/app/Base.java
Original file line number Diff line number Diff line change
Expand Up @@ -1877,6 +1877,15 @@ public void handleFontSizeChange(int change) {
PreferencesData.set("editor.font", StringUtils.join(pieces, ','));
getEditors().forEach(Editor::applyPreferences);
}

public void toggleLineNumber() {
if (PreferencesData.getBoolean("editor.linenumbers")) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be shortened to:
PreferencesData.setBoolean("editor.linenumbers", !PreferencesData.getBoolean("editor.linenumbers"));

PreferencesData.setBoolean("editor.linenumbers", false);
} else {
PreferencesData.setBoolean("editor.linenumbers", true);
}
getEditors().forEach(Editor::applyPreferences);
}

public List<JMenu> getBoardsCustomMenus() {
return boardsCustomMenus;
Expand Down
9 changes: 8 additions & 1 deletion app/src/processing/app/Editor.java
Original file line number Diff line number Diff line change
Expand Up @@ -1392,7 +1392,14 @@ public void actionPerformed(ActionEvent e) {
menu.add(decreaseFontSizeItem);

menu.addSeparator();


JMenuItem toggleLineNumber = newJMenuItemShift(tr("Toggle Line Numbers"), 'L');
toggleLineNumber.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
base.toggleLineNumber();
}
})

JMenuItem findItem = newJMenuItem(tr("Find..."), 'F');
findItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Expand Down