Skip to content

Commit 02e48bf

Browse files
committed
Fix #26402: Formatting lost when special character is copied and pasted
Copying and pasting a musical symbol with a modified size in a system text object caused the size to reset. This happened because the cursor used during insertion was from the paste location rather than the copied element. Additionally, the format was not properly stored in the edit text object (ed), so when TextBase::insertSym() was called, it lacked the correct formatting. I fixed this by ensuring the correct cursor was used for insertion and explicitly setting the format in the edit text object before passing it to TextBase::insertSym() during TextBase::paste(), preserving the symbol’s modified size.
1 parent 9d0803d commit 02e48bf

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/engraving/dom/textedit.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ void TextBase::insertSym(EditData& ed, SymId id)
271271
deleteSelectedText(ed);
272272
String s = score()->engravingFont()->toString(id);
273273
cursor->format()->setFontFamily(u"ScoreText");
274-
score()->undo(new InsertText(m_cursor, s), &ed);
274+
score()->undo(new InsertText(cursor, s), &ed);
275275
}
276276

277277
//---------------------------------------------------------
@@ -940,6 +940,7 @@ void TextBase::paste(EditData& ed, const String& txt)
940940
sym.clear();
941941
} else if (token == "/sym") {
942942
symState = false;
943+
static_cast<TextEditData*>(ed.getData(this).get())->cursor()->setFormat(format);
943944
insertSym(ed, SymNames::symIdByName(sym));
944945
} else {
945946
prepareFormat(token, format);

0 commit comments

Comments
 (0)