Skip to content

Commit

Permalink
Merge pull request #103 from guiv42/fix101
Browse files Browse the repository at this point in the history
fix display of an erroneous selection when switching tabs
  • Loading branch information
helge17 authored Sep 9, 2023
2 parents 785c915 + c421528 commit 9d40a35
Showing 1 changed file with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,23 @@ public TGBeatRange getBeatRange() {
private void saveState() {
TGDocumentListManager documents = TGDocumentListManager.getInstance(this.tablature.getContext());
TGDocument document = this.initial == null ? documents.findCurrentDocument() : documents.findDocument(this.initial.getMeasure().getTrack().getSong());
document.setSelectionStart(this.getStartBeat());
document.setSelectionEnd(this.getEndBeat());
if (isActive()) {
document.setSelectionStart(this.getStartBeat());
document.setSelectionEnd(this.getEndBeat());
} else {
document.setSelectionStart(null);
document.setSelectionEnd(null);
}
}

public void restoreStateFrom(TGDocument document) {
TGBeat start = document.getSelectionStart();
TGBeat end = document.getSelectionEnd();
this.initializeSelection(start);
this.updateSelection(end);
if ((start!=null) && (end!=null)) {
this.initializeSelection(start);
this.updateSelection(end);
} else {
this.clearSelection();
}
}
}

0 comments on commit 9d40a35

Please sign in to comment.