Skip to content

Commit

Permalink
fix #38766: bad input position after timesig change
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcSabatella committed Nov 11, 2014
1 parent ab6c2e6 commit 280c5d9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
15 changes: 15 additions & 0 deletions libmscore/edit.cpp
Expand Up @@ -431,6 +431,21 @@ bool Score::rewriteMeasures(Measure* fm, Measure* lm, const Fraction& ns)
qFatal("Cannot write measures");
connectTies(true);

if (noteEntryMode()) {
// set input cursor to possibly re-written segment
int icTick = inputPos();
Segment* icSegment = tick2segment(icTick, false, Segment::Type::ChordRest);
if (!icSegment) {
// this can happen if cursor was on a rest
// and in the rewriting it got subsumed into a full measure rest
Measure* icMeasure = tick2measure(icTick);
if (!icMeasure) // shouldn't happen, but just in case
icMeasure = firstMeasure();
icSegment = icMeasure->first(Segment::Type::ChordRest);
}
inputState().setSegment(icSegment);
}

return true;
}

Expand Down
3 changes: 3 additions & 0 deletions mscore/dragdrop.cpp
Expand Up @@ -605,6 +605,9 @@ void ScoreView::dropEvent(QDropEvent* event)
dragElement = 0;
setDropTarget(0); // this also resets dropRectangle and dropAnchor
score()->endCmd();
// update input cursor position (must be done after layout)
if (noteEntryMode())
moveCursor();
mscore->endCmd();
return;
}
Expand Down

0 comments on commit 280c5d9

Please sign in to comment.