1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-01 16:19:43 +02:00

Bug 2496 - Label edit typing prepends selected text

Problem:
labelStruct, a copy of the label is initialized before call to RemoveSelectedText() which acts on the real label. So when the label is updated using labelStruct, the selected text has not been removed.

Fix:
Initialize labelStruct after the call to RemoveSelectedText().
This commit is contained in:
David Bailes 2020-07-10 10:37:02 +01:00
parent b12fafbea0
commit 975ee0cc07

View File

@ -1637,14 +1637,14 @@ bool LabelTrackView::DoChar(
// Now we are definitely in a label; append the incoming character
//
const auto &mLabels = pTrack->GetLabels();
auto labelStruct = mLabels[mSelIndex];
auto &title = labelStruct.title;
// Test if cursor is in the end of string or not
if (mInitialCursorPos != mCurrentCursorPos)
RemoveSelectedText();
const auto& mLabels = pTrack->GetLabels();
auto labelStruct = mLabels[mSelIndex];
auto& title = labelStruct.title;
if (mCurrentCursorPos < (int)title.length()) {
// Get substring on the righthand side of cursor
wxString rightPart = title.Mid(mCurrentCursorPos);