mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 04:22:20 +02:00
Added more editor keys and commands
This commit is contained in:
parent
a3d8bd492d
commit
d463832168
5 changed files with 217 additions and 87 deletions
|
@ -1668,10 +1668,30 @@ namespace Beefy.widgets
|
||||||
return (int32)Math.Round(mTabSize / mCharWidth);
|
return (int32)Math.Round(mTabSize / mCharWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void KeyChar(char32 theChar)
|
public override void KeyChar(char32 keyChar)
|
||||||
{
|
{
|
||||||
base.KeyChar(theChar);
|
base.KeyChar(keyChar);
|
||||||
char32 useChar = theChar;
|
|
||||||
|
if (keyChar == '\x7F') // Ctrl+Backspace
|
||||||
|
{
|
||||||
|
int line;
|
||||||
|
int lineChar;
|
||||||
|
GetCursorLineChar(out line, out lineChar);
|
||||||
|
|
||||||
|
int startIdx = CursorTextPos;
|
||||||
|
SelectLeft(line, lineChar, true, false);
|
||||||
|
mSelection = EditSelection(CursorTextPos, startIdx);
|
||||||
|
|
||||||
|
var action = new DeleteSelectionAction(this);
|
||||||
|
action.mMoveCursor = true;
|
||||||
|
mData.mUndoManager.Add(action);
|
||||||
|
action.mCursorTextPos = (.)startIdx;
|
||||||
|
PhysDeleteSelection(true);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
char32 useChar = keyChar;
|
||||||
|
|
||||||
mCursorBlinkTicks = 0;
|
mCursorBlinkTicks = 0;
|
||||||
|
|
||||||
|
@ -2043,6 +2063,65 @@ namespace Beefy.widgets
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void SelectRight(int lineIdx, int lineChar, bool isChunkMove, bool isWordMove)
|
||||||
|
{
|
||||||
|
var lineIdx;
|
||||||
|
var lineChar;
|
||||||
|
|
||||||
|
int anIndex = GetTextIdx(lineIdx, lineChar);
|
||||||
|
char8 prevC = 0;
|
||||||
|
CharType prevCharType = (anIndex < mData.mTextLength) ? GetCharType((char8)mData.mText[anIndex].mChar) : .Unknown;
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
int lineStart;
|
||||||
|
int lineEnd;
|
||||||
|
GetLinePosition(lineIdx, out lineStart, out lineEnd);
|
||||||
|
int lineLen = lineEnd - lineStart;
|
||||||
|
|
||||||
|
int nextLineChar = lineChar + 1;
|
||||||
|
bool isWithinLine = nextLineChar < lineLen;
|
||||||
|
if (nextLineChar == lineLen)
|
||||||
|
{
|
||||||
|
GetTextData();
|
||||||
|
if ((mData.mTextFlags == null) || ((mData.mTextFlags[lineEnd] & (int32)TextFlags.Wrap) == 0))
|
||||||
|
{
|
||||||
|
isWithinLine = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isWithinLine)
|
||||||
|
MoveCursorTo(lineIdx, lineChar + 1, false, 1);
|
||||||
|
else if (lineIdx < GetLineCount() - 1)
|
||||||
|
MoveCursorTo(lineIdx + 1, 0);
|
||||||
|
|
||||||
|
if (!mWidgetWindow.IsKeyDown(KeyCode.Control))
|
||||||
|
break;
|
||||||
|
|
||||||
|
GetLineCharAtIdx(CursorTextPos, out lineIdx, out lineChar);
|
||||||
|
anIndex = GetTextIdx(lineIdx, lineChar);
|
||||||
|
if (anIndex == mData.mTextLength)
|
||||||
|
break;
|
||||||
|
|
||||||
|
char8 c = (char8)mData.mText[anIndex].mChar;
|
||||||
|
CharType char8Type = GetCharType(c);
|
||||||
|
if (char8Type == .Opening)
|
||||||
|
break;
|
||||||
|
if (char8Type != prevCharType)
|
||||||
|
{
|
||||||
|
if ((char8Type != .WhiteSpace) && (prevCharType == .WhiteSpace))
|
||||||
|
break;
|
||||||
|
if ((char8Type == .NewLine) || (char8Type == .NonBreaking) || (char8Type == .Other))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((isWordMove) && (c.IsUpper) && (prevC.IsLower))
|
||||||
|
break;
|
||||||
|
|
||||||
|
prevCharType = char8Type;
|
||||||
|
prevC = c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override void KeyDown(KeyCode keyCode, bool isRepeat)
|
public override void KeyDown(KeyCode keyCode, bool isRepeat)
|
||||||
{
|
{
|
||||||
base.KeyDown(keyCode, isRepeat);
|
base.KeyDown(keyCode, isRepeat);
|
||||||
|
@ -2062,21 +2141,21 @@ namespace Beefy.widgets
|
||||||
int prevCursorPos;
|
int prevCursorPos;
|
||||||
bool gotCursorPos = TryGetCursorTextPos(out prevCursorPos);
|
bool gotCursorPos = TryGetCursorTextPos(out prevCursorPos);
|
||||||
|
|
||||||
if (mWidgetWindow.GetKeyFlags() == KeyFlags.Ctrl)
|
if (mWidgetWindow.GetKeyFlags() == .Ctrl)
|
||||||
{
|
{
|
||||||
switch (keyCode)
|
switch (keyCode)
|
||||||
{
|
{
|
||||||
case (KeyCode)'A':
|
case (.)'A':
|
||||||
SelectAll();
|
SelectAll();
|
||||||
case (KeyCode)'C':
|
case (.)'C':
|
||||||
CopyText();
|
CopyText();
|
||||||
case (KeyCode)'X':
|
case (.)'X':
|
||||||
CutText();
|
CutText();
|
||||||
case (KeyCode)'V':
|
case (.)'V':
|
||||||
PasteText();
|
PasteText();
|
||||||
case (KeyCode)'Z':
|
case (.)'Z':
|
||||||
Undo();
|
Undo();
|
||||||
case (KeyCode)'Y':
|
case (.)'Y':
|
||||||
Redo();
|
Redo();
|
||||||
case .Return:
|
case .Return:
|
||||||
if (mIsMultiline)
|
if (mIsMultiline)
|
||||||
|
@ -2085,6 +2164,16 @@ namespace Beefy.widgets
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mWidgetWindow.GetKeyFlags() == .Ctrl | .Shift)
|
||||||
|
{
|
||||||
|
switch (keyCode)
|
||||||
|
{
|
||||||
|
case (.)'Z':
|
||||||
|
Redo();
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch (keyCode)
|
switch (keyCode)
|
||||||
{
|
{
|
||||||
case .Return:
|
case .Return:
|
||||||
|
@ -2175,60 +2264,8 @@ namespace Beefy.widgets
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isWordMove = mWidgetWindow.IsKeyDown(.Alt);
|
|
||||||
wasMoveKey = true;
|
wasMoveKey = true;
|
||||||
int anIndex = GetTextIdx(lineIdx, lineChar);
|
SelectRight(lineIdx, lineChar, mWidgetWindow.IsKeyDown(KeyCode.Control), mWidgetWindow.IsKeyDown(KeyCode.Alt));
|
||||||
char8 prevC = 0;
|
|
||||||
CharType prevCharType = (anIndex < mData.mTextLength) ? GetCharType((char8)mData.mText[anIndex].mChar) : .Unknown;
|
|
||||||
while (true)
|
|
||||||
{
|
|
||||||
int lineStart;
|
|
||||||
int lineEnd;
|
|
||||||
GetLinePosition(lineIdx, out lineStart, out lineEnd);
|
|
||||||
int lineLen = lineEnd - lineStart;
|
|
||||||
|
|
||||||
int nextLineChar = lineChar + 1;
|
|
||||||
bool isWithinLine = nextLineChar < lineLen;
|
|
||||||
if (nextLineChar == lineLen)
|
|
||||||
{
|
|
||||||
GetTextData();
|
|
||||||
if ((mData.mTextFlags == null) || ((mData.mTextFlags[lineEnd] & (int32)TextFlags.Wrap) == 0))
|
|
||||||
{
|
|
||||||
isWithinLine = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isWithinLine)
|
|
||||||
MoveCursorTo(lineIdx, lineChar + 1, false, 1);
|
|
||||||
else if (lineIdx < GetLineCount() - 1)
|
|
||||||
MoveCursorTo(lineIdx + 1, 0);
|
|
||||||
|
|
||||||
if (!mWidgetWindow.IsKeyDown(KeyCode.Control))
|
|
||||||
break;
|
|
||||||
|
|
||||||
GetLineCharAtIdx(CursorTextPos, out lineIdx, out lineChar);
|
|
||||||
anIndex = GetTextIdx(lineIdx, lineChar);
|
|
||||||
if (anIndex == mData.mTextLength)
|
|
||||||
break;
|
|
||||||
|
|
||||||
char8 c = (char8)mData.mText[anIndex].mChar;
|
|
||||||
CharType char8Type = GetCharType(c);
|
|
||||||
if (char8Type == .Opening)
|
|
||||||
break;
|
|
||||||
if (char8Type != prevCharType)
|
|
||||||
{
|
|
||||||
if ((char8Type != .WhiteSpace) && (prevCharType == .WhiteSpace))
|
|
||||||
break;
|
|
||||||
if ((char8Type == .NewLine) || (char8Type == .NonBreaking) || (char8Type == .Other))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((isWordMove) && (c.IsUpper) && (prevC.IsLower))
|
|
||||||
break;
|
|
||||||
|
|
||||||
prevCharType = char8Type;
|
|
||||||
prevC = c;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -2371,9 +2408,58 @@ namespace Beefy.widgets
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case KeyCode.Insert:
|
case KeyCode.Insert:
|
||||||
|
if ((mWidgetWindow.IsKeyDown(.Control)) && (mWidgetWindow.IsKeyDown(.Shift)))
|
||||||
|
break;
|
||||||
|
if (mWidgetWindow.IsKeyDown(.Control))
|
||||||
|
{
|
||||||
|
CopyText();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (mWidgetWindow.IsKeyDown(.Shift))
|
||||||
|
{
|
||||||
|
PasteText();
|
||||||
|
break;
|
||||||
|
}
|
||||||
mOverTypeMode = !mOverTypeMode;
|
mOverTypeMode = !mOverTypeMode;
|
||||||
break;
|
break;
|
||||||
case KeyCode.Delete:
|
case KeyCode.Delete:
|
||||||
|
if (mWidgetWindow.IsKeyDown(.Control))
|
||||||
|
{
|
||||||
|
if (mWidgetWindow.IsKeyDown(.Shift))
|
||||||
|
{
|
||||||
|
int startIdx = CursorTextPos;
|
||||||
|
CursorToLineEnd();
|
||||||
|
mSelection = EditSelection(CursorTextPos, startIdx);
|
||||||
|
var action = new DeleteSelectionAction(this);
|
||||||
|
action.mMoveCursor = true;
|
||||||
|
mData.mUndoManager.Add(action);
|
||||||
|
action.mCursorTextPos = (.)startIdx;
|
||||||
|
PhysDeleteSelection(true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
int line;
|
||||||
|
int lineChar2;
|
||||||
|
GetCursorLineChar(out line, out lineChar2);
|
||||||
|
|
||||||
|
int startIdx = CursorTextPos;
|
||||||
|
SelectRight(line, lineChar, true, false);
|
||||||
|
mSelection = EditSelection(CursorTextPos, startIdx);
|
||||||
|
|
||||||
|
var action = new DeleteSelectionAction(this);
|
||||||
|
action.mMoveCursor = true;
|
||||||
|
mData.mUndoManager.Add(action);
|
||||||
|
action.mCursorTextPos = (.)startIdx;
|
||||||
|
PhysDeleteSelection(true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mWidgetWindow.IsKeyDown(.Shift))
|
||||||
|
{
|
||||||
|
CutText();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (!CheckReadOnly())
|
if (!CheckReadOnly())
|
||||||
DeleteChar();
|
DeleteChar();
|
||||||
mCursorImplicitlyMoved = true;
|
mCursorImplicitlyMoved = true;
|
||||||
|
|
|
@ -191,9 +191,11 @@ namespace IDE
|
||||||
Add("Close All Windows", new () => { gApp.[Friend]TryCloseAllDocuments(); });
|
Add("Close All Windows", new () => { gApp.[Friend]TryCloseAllDocuments(); });
|
||||||
Add("Close Window", new () => { gApp.[Friend]TryCloseCurrentDocument(); });
|
Add("Close Window", new () => { gApp.[Friend]TryCloseCurrentDocument(); });
|
||||||
Add("Close Workspace", new => gApp.[Friend]Cmd_CloseWorkspaceAndSetupNew);
|
Add("Close Workspace", new => gApp.[Friend]Cmd_CloseWorkspaceAndSetupNew);
|
||||||
|
Add("Comment Selection", new => gApp.[Friend]CommentSelection);
|
||||||
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("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);
|
||||||
Add("Find Class", new => gApp.Cmd_FindClass);
|
Add("Find Class", new => gApp.Cmd_FindClass);
|
||||||
|
@ -276,6 +278,7 @@ namespace IDE
|
||||||
Add("Tab Last", new => gApp.[Friend]TabLast);
|
Add("Tab Last", new => gApp.[Friend]TabLast);
|
||||||
Add("Tab Next", new => gApp.[Friend]TabNext);
|
Add("Tab Next", new => gApp.[Friend]TabNext);
|
||||||
Add("Tab Prev", new => gApp.[Friend]TabPrev);
|
Add("Tab Prev", new => gApp.[Friend]TabPrev);
|
||||||
|
Add("Uncomment Selection", new => gApp.[Friend]UncommentSelection);
|
||||||
Add("View New", new => gApp.Cmd_ViewNew);
|
Add("View New", new => gApp.Cmd_ViewNew);
|
||||||
Add("View Split", new => gApp.[Friend]ViewSplit);
|
Add("View Split", new => gApp.[Friend]ViewSplit);
|
||||||
Add("View White Space", new => gApp.Cmd_ViewWhiteSpace);
|
Add("View White Space", new => gApp.Cmd_ViewWhiteSpace);
|
||||||
|
|
|
@ -2291,6 +2291,30 @@ namespace IDE
|
||||||
//FinishShowingNewWorkspace();
|
//FinishShowingNewWorkspace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[IDECommand]
|
||||||
|
void DuplicateLine()
|
||||||
|
{
|
||||||
|
var sewc = GetActiveSourceEditWidgetContent();
|
||||||
|
if (sewc != null)
|
||||||
|
sewc.DuplicateLine();
|
||||||
|
}
|
||||||
|
|
||||||
|
[IDECommand]
|
||||||
|
void CommentSelection()
|
||||||
|
{
|
||||||
|
var sewc = GetActiveSourceEditWidgetContent();
|
||||||
|
if (sewc != null)
|
||||||
|
sewc.ToggleComment(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
[IDECommand]
|
||||||
|
void UncommentSelection()
|
||||||
|
{
|
||||||
|
var sewc = GetActiveSourceEditWidgetContent();
|
||||||
|
if (sewc != null)
|
||||||
|
sewc.ToggleComment(false);
|
||||||
|
}
|
||||||
|
|
||||||
public Result<void, StructuredData.Error> StructuredLoad(StructuredData data, StringView filePath)
|
public Result<void, StructuredData.Error> StructuredLoad(StructuredData data, StringView filePath)
|
||||||
{
|
{
|
||||||
if (mWorkspace.IsSingleFileWorkspace)
|
if (mWorkspace.IsSingleFileWorkspace)
|
||||||
|
|
|
@ -448,6 +448,8 @@ namespace IDE
|
||||||
Add("Cancel Build", "Ctrl+Break");
|
Add("Cancel Build", "Ctrl+Break");
|
||||||
Add("Close Window", "Ctrl+W");
|
Add("Close Window", "Ctrl+W");
|
||||||
Add("Compile File", "Ctrl+F7");
|
Add("Compile File", "Ctrl+F7");
|
||||||
|
Add("Comment Selection", "Ctrl+K, Ctrl+C");
|
||||||
|
Add("Duplicate Line", "Ctrl+D");
|
||||||
Add("Find Class", "Alt+Shift+L");
|
Add("Find Class", "Alt+Shift+L");
|
||||||
Add("Find in Document", "Ctrl+F");
|
Add("Find in Document", "Ctrl+F");
|
||||||
Add("Find in Files", "Ctrl+Shift+F");
|
Add("Find in Files", "Ctrl+Shift+F");
|
||||||
|
@ -512,6 +514,7 @@ namespace IDE
|
||||||
Add("Tab Last", "Ctrl+Alt+End");
|
Add("Tab Last", "Ctrl+Alt+End");
|
||||||
Add("Tab Next", "Ctrl+Alt+PageDown");
|
Add("Tab Next", "Ctrl+Alt+PageDown");
|
||||||
Add("Tab Prev", "Ctrl+Alt+PageUp");
|
Add("Tab Prev", "Ctrl+Alt+PageUp");
|
||||||
|
Add("Uncomment Selection", "Ctrl+K, Ctrl+U");
|
||||||
Add("Zoom In", "Ctrl+Equals");
|
Add("Zoom In", "Ctrl+Equals");
|
||||||
Add("Zoom Out", "Ctrl+Minus");
|
Add("Zoom Out", "Ctrl+Minus");
|
||||||
Add("Zoom Reset", "Ctrl+0");
|
Add("Zoom Reset", "Ctrl+0");
|
||||||
|
|
|
@ -1984,18 +1984,20 @@ namespace IDE.ui
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool ToggleComment()
|
public bool ToggleComment(bool? doComment = null)
|
||||||
{
|
{
|
||||||
if (CheckReadOnly())
|
if (CheckReadOnly())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ((HasSelection()) && (mSelection.Value.Length > 1))
|
if ((HasSelection()) && (mSelection.Value.Length > 1))
|
||||||
{
|
{
|
||||||
var startLineAndCol = CursorLineAndColumn ;
|
var startLineAndCol = CursorLineAndColumn;
|
||||||
|
|
||||||
UndoBatchStart undoBatchStart = new UndoBatchStart("embeddedToggleComment");
|
UndoBatchStart undoBatchStart = new UndoBatchStart("embeddedToggleComment");
|
||||||
mData.mUndoManager.Add(undoBatchStart);
|
mData.mUndoManager.Add(undoBatchStart);
|
||||||
|
|
||||||
|
mData.mUndoManager.Add(new SetCursorAction(this));
|
||||||
|
|
||||||
int minPos = mSelection.GetValueOrDefault().MinPos;
|
int minPos = mSelection.GetValueOrDefault().MinPos;
|
||||||
int maxPos = mSelection.GetValueOrDefault().MaxPos;
|
int maxPos = mSelection.GetValueOrDefault().MaxPos;
|
||||||
mSelection = null;
|
mSelection = null;
|
||||||
|
@ -2014,7 +2016,7 @@ namespace IDE.ui
|
||||||
int firstCharPos = minPos + (startLen - afterTrimStart);
|
int firstCharPos = minPos + (startLen - afterTrimStart);
|
||||||
int lastCharPos = maxPos - (afterTrimStart - afterTrimEnd);
|
int lastCharPos = maxPos - (afterTrimStart - afterTrimEnd);
|
||||||
|
|
||||||
if (trimmedStr.StartsWith("/*"))
|
if ((doComment != true) && (trimmedStr.StartsWith("/*")))
|
||||||
{
|
{
|
||||||
if (trimmedStr.EndsWith("*/"))
|
if (trimmedStr.EndsWith("*/"))
|
||||||
{
|
{
|
||||||
|
@ -2022,14 +2024,20 @@ namespace IDE.ui
|
||||||
DeleteChar();
|
DeleteChar();
|
||||||
mSelection = EditSelection(lastCharPos - 4, lastCharPos - 2);
|
mSelection = EditSelection(lastCharPos - 4, lastCharPos - 2);
|
||||||
DeleteChar();
|
DeleteChar();
|
||||||
|
|
||||||
|
if (doComment != null)
|
||||||
|
mSelection = EditSelection(firstCharPos, lastCharPos - 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else if (doComment != false)
|
||||||
{
|
{
|
||||||
CursorTextPos = firstCharPos;
|
CursorTextPos = firstCharPos;
|
||||||
InsertAtCursor("/*");
|
InsertAtCursor("/*");
|
||||||
CursorTextPos = lastCharPos + 2;
|
CursorTextPos = lastCharPos + 2;
|
||||||
InsertAtCursor("*/");
|
InsertAtCursor("*/");
|
||||||
|
|
||||||
|
if (doComment != null)
|
||||||
|
mSelection = EditSelection(firstCharPos, lastCharPos + 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (undoBatchStart != null)
|
if (undoBatchStart != null)
|
||||||
|
@ -2037,13 +2045,36 @@ namespace IDE.ui
|
||||||
|
|
||||||
CursorLineAndColumn = startLineAndCol;
|
CursorLineAndColumn = startLineAndCol;
|
||||||
|
|
||||||
|
if (doComment == null)
|
||||||
mSelection = null;
|
mSelection = null;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void DuplicateLine()
|
||||||
|
{
|
||||||
|
UndoBatchStart undoBatchStart = new UndoBatchStart("embeddedToggleComment");
|
||||||
|
mData.mUndoManager.Add(undoBatchStart);
|
||||||
|
|
||||||
|
mData.mUndoManager.Add(new SetCursorAction(this));
|
||||||
|
|
||||||
|
var prevCursorLineAndColumn = CursorLineAndColumn;
|
||||||
|
int lineNum = CursorLineAndColumn.mLine;
|
||||||
|
GetLinePosition(lineNum, var lineStart, var lineEnd);
|
||||||
|
var str = scope String();
|
||||||
|
GetLineText(lineNum, str);
|
||||||
|
mSelection = null;
|
||||||
|
str.Append("\n");
|
||||||
|
CursorLineAndColumn = LineAndColumn(lineNum, 0);
|
||||||
|
InsertAtCursor(str);
|
||||||
|
CursorLineAndColumn = LineAndColumn(prevCursorLineAndColumn.mLine + 1, prevCursorLineAndColumn.mColumn);
|
||||||
|
|
||||||
|
mData.mUndoManager.Add(undoBatchStart.mBatchEnd);
|
||||||
|
}
|
||||||
|
|
||||||
public override void ContentChanged()
|
public override void ContentChanged()
|
||||||
{
|
{
|
||||||
base.ContentChanged();
|
base.ContentChanged();
|
||||||
|
@ -2064,24 +2095,7 @@ namespace IDE.ui
|
||||||
scope AutoBeefPerf("SEWC.KeyChar");
|
scope AutoBeefPerf("SEWC.KeyChar");
|
||||||
|
|
||||||
var keyChar;
|
var keyChar;
|
||||||
if (keyChar == '\x7F') // Ctrl+Backspace
|
|
||||||
{
|
|
||||||
int line;
|
|
||||||
int lineChar;
|
|
||||||
GetCursorLineChar(out line, out lineChar);
|
|
||||||
|
|
||||||
int startIdx = CursorTextPos;
|
|
||||||
SelectLeft(line, lineChar, true, false);
|
|
||||||
mSelection = EditSelection(CursorTextPos, startIdx);
|
|
||||||
|
|
||||||
var action = new DeleteSelectionAction(this);
|
|
||||||
action.mMoveCursor = true;
|
|
||||||
mData.mUndoManager.Add(action);
|
|
||||||
action.mCursorTextPos = (.)startIdx;
|
|
||||||
PhysDeleteSelection(true);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mIgnoreKeyChar)
|
if (mIgnoreKeyChar)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue