Skip to content

Commit 3e1acd5

Browse files
Auto-convert plain text on the clipboard to LiveCode styled text runs
1 parent 51d8a60 commit 3e1acd5

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

engine/src/clipboard.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,7 @@ bool MCClipboard::CopyAsLiveCodeStyledText(MCDataRef& r_pickled_text) const
832832
}
833833
}
834834

835-
// Could not grab as either styled text or RTF. One last try with HTML...
835+
// Could not grab as either styled text or RTF. Try with HTML.
836836
MCAutoDataRef t_html;
837837
if (CopyAsData(kMCRawClipboardKnownTypeHTML, &t_html))
838838
{
@@ -845,6 +845,19 @@ bool MCClipboard::CopyAsLiveCodeStyledText(MCDataRef& r_pickled_text) const
845845
}
846846
}
847847

848+
// Finally, try plain text.
849+
MCAutoStringRef t_plain_text;
850+
if (CopyAsText(&t_plain_text))
851+
{
852+
// Convert to LiveCode styled text
853+
MCDataRef t_pickled_text = ConvertTextToStyledText(*t_plain_text);
854+
if (t_pickled_text != NULL)
855+
{
856+
r_pickled_text = t_pickled_text;
857+
return true;
858+
}
859+
}
860+
848861
// There was nothing on the clipboard that could be converted to LiveCode
849862
// styled text.
850863
return false;

0 commit comments

Comments
 (0)