| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -93,12 +93,10 @@ public class PDEX { | |||
| 93 | 93 | private Rename rename; | |
| 94 | 94 | private DebugTree debugTree; | |
| 95 | 95 | ||
| 96 | - private JavaEditor editor; | ||
| 97 | 96 | private PreprocessingService pps; | |
| 98 | 97 | ||
| 99 | 98 | ||
| 100 | 99 | public PDEX(JavaEditor editor, PreprocessingService pps) { | |
| 101 | - this.editor = editor; | ||
| 102 | 100 | this.pps = pps; | |
| 103 | 101 | ||
| 104 | 102 | this.enabled = !editor.hasJavaTabs(); | |
@@ -803,8 +801,6 @@ void rename(PreprocessedSketch ps, IBinding binding, String newName) { | |||
| 803 | 801 | ||
| 804 | 802 | editor.startCompoundEdit(); | |
| 805 | 803 | ||
| 806 | - int currentTabIndex = sketch.getCurrentCodeIndex(); | ||
| 807 | - final int currentOffset = editor.getCaretOffset(); | ||
| 808 | 804 | mappedNodes.entrySet().forEach(entry -> { | |
| 809 | 805 | int tabIndex = entry.getKey(); | |
| 810 | 806 | SketchCode sketchCode = sketch.getCode(tabIndex); | |
@@ -833,9 +829,15 @@ void rename(PreprocessedSketch ps, IBinding binding, String newName) { | |||
| 833 | 829 | sketchCode.setProgram(document.getText(0, document.getLength())); | |
| 834 | 830 | } catch (BadLocationException e) { /* Whatever */ } | |
| 835 | 831 | sketchCode.setModified(true); | |
| 836 | - editor.repaintHeader(); | ||
| 837 | 832 | }); | |
| 838 | 833 | ||
| 834 | + editor.stopCompoundEdit(); | ||
| 835 | + | ||
| 836 | + editor.repaintHeader(); | ||
| 837 | + | ||
| 838 | + int currentTabIndex = sketch.getCurrentCodeIndex(); | ||
| 839 | + final int currentOffset = editor.getCaretOffset(); | ||
| 840 | + | ||
| 839 | 841 | int precedingIntervals = | |
| 840 | 842 | (int) mappedNodes.getOrDefault(currentTabIndex, Collections.emptyList()) | |
| 841 | 843 | .stream() | |
@@ -844,10 +846,8 @@ void rename(PreprocessedSketch ps, IBinding binding, String newName) { | |||
| 844 | 846 | int intervalLengthDiff = newName.length() - binding.getName().length(); | |
| 845 | 847 | int offsetDiff = precedingIntervals * intervalLengthDiff; | |
| 846 | 848 | ||
| 847 | - sketch.setCurrentCode(currentTabIndex); | ||
| 848 | 849 | editor.getTextArea().setCaretPosition(currentOffset + offsetDiff); | |
| 849 | 850 | ||
| 850 | - editor.stopCompoundEdit(); | ||
| 851 | 851 | } | |
| 852 | 852 | ||
| 853 | 853 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments