GRAPHICS: MACGUI: add default format before we are using the text from global clipboard

This commit is contained in:
ysj1173886760 2021-06-02 21:56:11 +08:00 committed by Eugene Sandulenko
parent d4abe958bd
commit 4419ae9a0b
3 changed files with 5 additions and 5 deletions

View File

@ -1728,7 +1728,7 @@ Common::U32String MacText::getTextChunk(int startRow, int startCol, int endRow,
// mostly, we refering reshuffleParagraph to implement this function
void MacText::insertTextFromClipboard() {
int ppos = 0;
Common::U32String str = _wm->getTextFromClipboard(&ppos);
Common::U32String str = _wm->getTextFromClipboard(Common::U32String(_defaultFormatting.toString()), &ppos);
if (_textLines.empty()) {
splitString(str, 0);

View File

@ -430,13 +430,13 @@ void MacWindowManager::setTextInClipboard(const Common::U32String &str) {
g_system->setTextInClipboard(stripFormat(str));
}
Common::U32String MacWindowManager::getTextFromClipboard(int *size) {
Common::U32String MacWindowManager::getTextFromClipboard(const Common::U32String &format, int *size) {
Common::U32String global_str = g_system->getTextFromClipboard();
// str is what we need
Common::U32String str;
if (_clipboard.empty()) {
// if wm clipboard is empty, then we use the global clipboard, which won't contain the format
str = global_str;
str = format + global_str;
if (size)
*size = str.size();
} else {
@ -448,7 +448,7 @@ Common::U32String MacWindowManager::getTextFromClipboard(int *size) {
*size = tmp.size();
} else {
// otherwise, we prefer the global one
str = global_str;
str = format + global_str;
if (size)
*size = str.size();
}

View File

@ -321,7 +321,7 @@ public:
* @param size will change to the length of real text in clipboard
* @return the text in clipboard, which may contained the format
*/
Common::U32String getTextFromClipboard(int *size = nullptr);
Common::U32String getTextFromClipboard(const Common::U32String &format = Common::U32String(), int *size = nullptr);
public:
MacFontManager *_fontMan;