mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 19:48:20 +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:
parent
fd08367e2b
commit
3e201c324d
3 changed files with 42 additions and 0 deletions
|
@ -198,6 +198,7 @@ namespace IDE
|
|||
Add("Compile File", new => gApp.Cmd_CompileFile);
|
||||
Add("Debug All Tests", new () => { gApp.[Friend]RunTests(true, true); });
|
||||
Add("Debug Normal Tests", new () => { gApp.[Friend]RunTests(false, true); });
|
||||
Add("Delete All Right", new => gApp.[Friend]DeleteAllRight);
|
||||
Add("Duplicate Line", new () => { gApp.[Friend]DuplicateLine(); });
|
||||
Add("Exit", new => gApp.[Friend]Cmd_Exit);
|
||||
Add("Find All References", new => gApp.Cmd_FindAllReferences);
|
||||
|
|
|
@ -2409,6 +2409,12 @@ namespace IDE
|
|||
//CloseWorkspace();
|
||||
//FinishShowingNewWorkspace();
|
||||
}
|
||||
|
||||
[IDECommand]
|
||||
void DeleteAllRight()
|
||||
{
|
||||
GetActiveSourceEditWidgetContent()?.DeleteAllRight();
|
||||
}
|
||||
|
||||
[IDECommand]
|
||||
void DuplicateLine()
|
||||
|
|
|
@ -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()
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue