Skip to content
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

Navigator now correctly handles new mapped items #232

Open
wants to merge 1 commit 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
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,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
Loading