mirror of
https://github.com/processing/processing4.git
synced 2026-02-04 06:09:17 +01:00
PDEX: Remove some unnecessary calls from rename
This commit is contained in:
@@ -93,12 +93,10 @@ public class PDEX {
|
||||
private Rename rename;
|
||||
private DebugTree debugTree;
|
||||
|
||||
private JavaEditor editor;
|
||||
private PreprocessingService pps;
|
||||
|
||||
|
||||
public PDEX(JavaEditor editor, PreprocessingService pps) {
|
||||
this.editor = editor;
|
||||
this.pps = pps;
|
||||
|
||||
this.enabled = !editor.hasJavaTabs();
|
||||
@@ -803,8 +801,6 @@ public class PDEX {
|
||||
|
||||
editor.startCompoundEdit();
|
||||
|
||||
int currentTabIndex = sketch.getCurrentCodeIndex();
|
||||
final int currentOffset = editor.getCaretOffset();
|
||||
mappedNodes.entrySet().forEach(entry -> {
|
||||
int tabIndex = entry.getKey();
|
||||
SketchCode sketchCode = sketch.getCode(tabIndex);
|
||||
@@ -833,9 +829,15 @@ public class PDEX {
|
||||
sketchCode.setProgram(document.getText(0, document.getLength()));
|
||||
} catch (BadLocationException e) { /* Whatever */ }
|
||||
sketchCode.setModified(true);
|
||||
editor.repaintHeader();
|
||||
});
|
||||
|
||||
editor.stopCompoundEdit();
|
||||
|
||||
editor.repaintHeader();
|
||||
|
||||
int currentTabIndex = sketch.getCurrentCodeIndex();
|
||||
final int currentOffset = editor.getCaretOffset();
|
||||
|
||||
int precedingIntervals =
|
||||
(int) mappedNodes.getOrDefault(currentTabIndex, Collections.emptyList())
|
||||
.stream()
|
||||
@@ -844,10 +846,8 @@ public class PDEX {
|
||||
int intervalLengthDiff = newName.length() - binding.getName().length();
|
||||
int offsetDiff = precedingIntervals * intervalLengthDiff;
|
||||
|
||||
sketch.setCurrentCode(currentTabIndex);
|
||||
editor.getTextArea().setCaretPosition(currentOffset + offsetDiff);
|
||||
|
||||
editor.stopCompoundEdit();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user