1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 11:38:21 +02:00

Fixed copy text in read-only panels

This commit is contained in:
Brian Fiete 2020-08-31 13:15:59 -07:00
parent 76a8f2d7bb
commit f008a98105

View file

@ -2003,35 +2003,32 @@ namespace Beefy.widgets
void CopyText(bool cut)
{
if (!CheckReadOnly())
bool selectedLine = false;
String extra = scope .();
if (!HasSelection())
{
bool selectedLine = false;
String extra = scope .();
if (!HasSelection())
{
selectedLine = true;
GetLinePosition(CursorLineAndColumn.mLine, var lineStart, var lineEnd);
mSelection = .(lineStart, lineEnd);
extra.Append("line");
}
String selText = scope String();
GetSelectionText(selText);
BFApp.sApp.SetClipboardText(selText, extra);
if (cut)
{
if (selectedLine)
{
// Remove \n
if (mSelection.Value.mEndPos < mData.mTextLength)
mSelection.ValueRef.mEndPos++;
}
DeleteSelection();
}
if (selectedLine)
mSelection = null;
selectedLine = true;
GetLinePosition(CursorLineAndColumn.mLine, var lineStart, var lineEnd);
mSelection = .(lineStart, lineEnd);
extra.Append("line");
}
String selText = scope String();
GetSelectionText(selText);
BFApp.sApp.SetClipboardText(selText, extra);
if ((cut) && (!CheckReadOnly()))
{
if (selectedLine)
{
// Remove \n
if (mSelection.Value.mEndPos < mData.mTextLength)
mSelection.ValueRef.mEndPos++;
}
DeleteSelection();
}
if (selectedLine)
mSelection = null;
}
public void CutText()