mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 04:22:20 +02:00
Fixed copy text in read-only panels
This commit is contained in:
parent
76a8f2d7bb
commit
f008a98105
1 changed files with 24 additions and 27 deletions
|
@ -2003,35 +2003,32 @@ namespace Beefy.widgets
|
||||||
|
|
||||||
void CopyText(bool cut)
|
void CopyText(bool cut)
|
||||||
{
|
{
|
||||||
if (!CheckReadOnly())
|
bool selectedLine = false;
|
||||||
|
String extra = scope .();
|
||||||
|
if (!HasSelection())
|
||||||
{
|
{
|
||||||
bool selectedLine = false;
|
selectedLine = true;
|
||||||
String extra = scope .();
|
GetLinePosition(CursorLineAndColumn.mLine, var lineStart, var lineEnd);
|
||||||
if (!HasSelection())
|
mSelection = .(lineStart, lineEnd);
|
||||||
{
|
extra.Append("line");
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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()
|
public void CutText()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue