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

Fix: Remove \n for last fragment in CopyText()

This commit is contained in:
Chernyavsky Andrey 2025-05-17 11:47:45 +05:00
parent 1d9c51e28d
commit 8ba66f664b

View file

@ -2376,6 +2376,9 @@ namespace Beefy.widgets
// ...
ExtractString(selection.mStartPos, selection.Length, cursorText);
// Skip new line for last fragment
if (@cursor.Index+1 < mTextCursors.Count)
cursorText.Append('\n');
text.Append(cursorText);
@ -2556,8 +2559,6 @@ namespace Beefy.widgets
{
if ((cursorExtra.Length == 0) || (HasSelection()))
{
/*if ((cursorExtra.Length == 0) && (cursorText[cursorText.Length-1] == '\n'))
cursorText.RemoveFromEnd(1);*/
PasteText(cursorText);
}
else// if (fragment.mExtra == "line")
@ -2602,8 +2603,6 @@ namespace Beefy.widgets
{
var fragment = fragments[idx];
var length = fragment.mText.Length;
if (idx + 1 == fragments.Count)
length--;
PasteFragment(scope String(fragment.mText, 0, length), "");
if (idx + 1 < fragments.Count)
@ -2653,6 +2652,8 @@ namespace Beefy.widgets
var fragment = fragments[idx--];
String cursorText = scope String(fragment.mText, 0, fragment.mText.Length);
if (@cursor.Index+1 < sortedCursors.Count)
cursorText.RemoveFromEnd(1);
mData.mUndoManager.Add(new SetCursorAction(this));