Skip to content

Commit

Permalink
Fix navigator (#232)
Browse files Browse the repository at this point in the history
  • Loading branch information
PiTheGuy authored Oct 16, 2024
1 parent 78a9a8b commit a38a3e4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ private void applyChange0(ValidationContext vc, EntryChange<?> change, boolean u
boolean renamed = !change.getDeobfName().isUnchanged();
this.gui.updateStructure(this.gui.getActiveEditor());
if (this.gui.getActiveEditor() != null) {
this.gui.getActiveEditor().onRename();
this.gui.getActiveEditor().onRename(prev.targetName() == null && mapping.targetName() != null);
}

if (!Objects.equals(prev.targetName(), mapping.targetName()) || !Objects.equals(prev.tokenType(), mapping.tokenType())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ private void wrapIndex() {
}
}

public void decrementIndex() {
this.currentIndex--;
}

private void tryNavigate() {
this.gui.getController().navigateTo(this.entries.get(this.selectedType).get(this.currentIndex));
this.updateStatsLabel();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,9 @@ public void keyReleased(KeyEvent event) {
this.ui.putClientProperty(EditorPanel.class, this);
}

public void onRename() {
public void onRename(boolean isNewMapping) {
this.navigatorPanel.updateAllTokenTypes();
if (isNewMapping) this.navigatorPanel.decrementIndex();
}

@Nullable
Expand Down

0 comments on commit a38a3e4

Please sign in to comment.