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

Add "Delete All Right" command to IDE

Deletes all characters from cursor position to the end of current line.
This commit is contained in:
miere43 2021-11-04 23:18:27 +03:00
parent fd08367e2b
commit 3e201c324d
3 changed files with 42 additions and 0 deletions

View file

@ -2237,6 +2237,41 @@ namespace IDE.ui
return false;
}
public void DeleteAllRight()
{
int startPos;
int endPos;
if (HasSelection())
{
mSelection.ValueRef.GetAsForwardSelect(out startPos, out endPos);
}
else
{
startPos = endPos = CursorTextPos;
}
int line;
int lineChar;
GetLineCharAtIdx(endPos, out line, out lineChar);
let lineText = scope String();
GetLineText(line, lineText);
endPos += lineText.Length - lineChar;
if (startPos == endPos)
{
return;
}
mSelection = EditSelection();
mSelection.ValueRef.mStartPos = (int32)startPos;
mSelection.ValueRef.mEndPos = (int32)endPos;
DeleteSelection();
CursorTextPos = startPos;
}
public void DuplicateLine()
{