mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 12:02: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:
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("Compile File", new => gApp.Cmd_CompileFile);
|
||||||
Add("Debug All Tests", new () => { gApp.[Friend]RunTests(true, true); });
|
Add("Debug All Tests", new () => { gApp.[Friend]RunTests(true, true); });
|
||||||
Add("Debug Normal Tests", new () => { gApp.[Friend]RunTests(false, 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("Duplicate Line", new () => { gApp.[Friend]DuplicateLine(); });
|
||||||
Add("Exit", new => gApp.[Friend]Cmd_Exit);
|
Add("Exit", new => gApp.[Friend]Cmd_Exit);
|
||||||
Add("Find All References", new => gApp.Cmd_FindAllReferences);
|
Add("Find All References", new => gApp.Cmd_FindAllReferences);
|
||||||
|
|
|
@ -2410,6 +2410,12 @@ namespace IDE
|
||||||
//FinishShowingNewWorkspace();
|
//FinishShowingNewWorkspace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[IDECommand]
|
||||||
|
void DeleteAllRight()
|
||||||
|
{
|
||||||
|
GetActiveSourceEditWidgetContent()?.DeleteAllRight();
|
||||||
|
}
|
||||||
|
|
||||||
[IDECommand]
|
[IDECommand]
|
||||||
void DuplicateLine()
|
void DuplicateLine()
|
||||||
{
|
{
|
||||||
|
|
|
@ -2238,6 +2238,41 @@ namespace IDE.ui
|
||||||
return false;
|
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()
|
public void DuplicateLine()
|
||||||
{
|
{
|
||||||
UndoBatchStart undoBatchStart = new UndoBatchStart("duplicateLine");
|
UndoBatchStart undoBatchStart = new UndoBatchStart("duplicateLine");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue