diff --git a/TuxGuitar/src/org/herac/tuxguitar/app/view/component/tab/Selector.java b/TuxGuitar/src/org/herac/tuxguitar/app/view/component/tab/Selector.java index 7b6401ce7..2dc5288ec 100644 --- a/TuxGuitar/src/org/herac/tuxguitar/app/view/component/tab/Selector.java +++ b/TuxGuitar/src/org/herac/tuxguitar/app/view/component/tab/Selector.java @@ -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(); + } } }