mirror of
https://github.com/arduino/Arduino.git
synced 2024-12-01 12:24:14 +01:00
Restored current line/current selected lines display on lower left of the IDE. Fixes #3134
This commit is contained in:
parent
54da4d6d37
commit
d57681c442
@ -251,7 +251,7 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
console.setBorder(null);
|
||||
consolePanel.add(console, BorderLayout.CENTER);
|
||||
|
||||
lineStatus = new EditorLineStatus(textarea);
|
||||
lineStatus = new EditorLineStatus();
|
||||
consolePanel.add(lineStatus, BorderLayout.SOUTH);
|
||||
|
||||
// RTextScrollPane
|
||||
@ -957,7 +957,7 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
|
||||
|
||||
protected SketchTextArea createTextArea() throws IOException {
|
||||
SketchTextArea textArea = new SketchTextArea(base.getPdeKeywords());
|
||||
final SketchTextArea textArea = new SketchTextArea(base.getPdeKeywords());
|
||||
textArea.requestFocusInWindow();
|
||||
textArea.setMarkOccurrences(PreferencesData.getBoolean("editor.advanced"));
|
||||
textArea.setMarginLineEnabled(false);
|
||||
@ -976,6 +976,17 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
}
|
||||
}
|
||||
});
|
||||
textArea.addCaretListener(new CaretListener() {
|
||||
|
||||
@Override
|
||||
public void caretUpdate(CaretEvent e) {
|
||||
int lineStart = textArea.getDocument().getDefaultRootElement().getElementIndex(e.getMark());
|
||||
int lineEnd = textArea.getDocument().getDefaultRootElement().getElementIndex(e.getDot());
|
||||
|
||||
lineStatus.set(lineStart, lineEnd);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
ToolTipManager.sharedInstance().registerComponent(textArea);
|
||||
|
||||
|
@ -37,8 +37,6 @@ import processing.app.syntax.SketchTextArea;
|
||||
* Li'l status bar fella that shows the line number.
|
||||
*/
|
||||
public class EditorLineStatus extends JComponent {
|
||||
SketchTextArea textarea;
|
||||
|
||||
int start = -1, stop;
|
||||
|
||||
Image resize;
|
||||
@ -55,11 +53,7 @@ public class EditorLineStatus extends JComponent {
|
||||
String serialport = "";
|
||||
|
||||
|
||||
public EditorLineStatus(SketchTextArea textarea) {
|
||||
|
||||
this.textarea = textarea;
|
||||
textarea.setEditorLineStatus(this);
|
||||
|
||||
public EditorLineStatus() {
|
||||
background = Theme.getColor("linestatus.bgcolor");
|
||||
font = Theme.getFont("linestatus.font");
|
||||
foreground = Theme.getColor("linestatus.color");
|
||||
|
@ -76,11 +76,6 @@ public class SketchTextArea extends RSyntaxTextArea {
|
||||
*/
|
||||
private FocusableTip docTooltip;
|
||||
|
||||
/**
|
||||
* The component that tracks the current line number.
|
||||
*/
|
||||
protected EditorLineStatus editorLineStatus;
|
||||
|
||||
private EditorListener editorListener;
|
||||
|
||||
private final PdeKeywords pdeKeywords;
|
||||
@ -168,14 +163,9 @@ public class SketchTextArea extends RSyntaxTextArea {
|
||||
}
|
||||
|
||||
|
||||
public void setEditorLineStatus(EditorLineStatus editorLineStatus) {
|
||||
this.editorLineStatus = editorLineStatus;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void select(int selectionStart, int selectionEnd) {
|
||||
super.select(selectionStart, selectionEnd);
|
||||
if (editorLineStatus != null) editorLineStatus.set(selectionStart, selectionEnd);
|
||||
}
|
||||
|
||||
public boolean isSelectionActive() {
|
||||
|
Loading…
Reference in New Issue
Block a user