mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 03:52:19 +02:00
Merge pull request #988 from EinBurgbauer/editwidget-readonly-fix
fix readonly editwidget deletion
This commit is contained in:
commit
f34424a61d
1 changed files with 36 additions and 33 deletions
|
@ -1700,29 +1700,29 @@ namespace Beefy.widgets
|
||||||
|
|
||||||
if (keyChar == '\x7F') // Ctrl+Backspace
|
if (keyChar == '\x7F') // Ctrl+Backspace
|
||||||
{
|
{
|
||||||
int line;
|
if (!CheckReadOnly())
|
||||||
int lineChar;
|
{
|
||||||
GetCursorLineChar(out line, out lineChar);
|
int line;
|
||||||
|
int lineChar;
|
||||||
|
GetCursorLineChar(out line, out lineChar);
|
||||||
|
|
||||||
int startIdx = CursorTextPos;
|
int startIdx = CursorTextPos;
|
||||||
SelectLeft(line, lineChar, true, false);
|
SelectLeft(line, lineChar, true, false);
|
||||||
mSelection = EditSelection(CursorTextPos, startIdx);
|
mSelection = EditSelection(CursorTextPos, startIdx);
|
||||||
|
|
||||||
var action = new DeleteSelectionAction(this);
|
var action = new DeleteSelectionAction(this);
|
||||||
action.mMoveCursor = true;
|
action.mMoveCursor = true;
|
||||||
mData.mUndoManager.Add(action);
|
mData.mUndoManager.Add(action);
|
||||||
action.mCursorTextPos = (.)startIdx;
|
action.mCursorTextPos = (.)startIdx;
|
||||||
PhysDeleteSelection(true);
|
PhysDeleteSelection(true);
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
char32 useChar = keyChar;
|
char32 useChar = keyChar;
|
||||||
|
|
||||||
mCursorBlinkTicks = 0;
|
mCursorBlinkTicks = 0;
|
||||||
|
|
||||||
if (useChar == '\x7F') // Ctrl+Backspace
|
|
||||||
useChar = '\b';
|
|
||||||
|
|
||||||
if (useChar == '\b')
|
if (useChar == '\b')
|
||||||
{
|
{
|
||||||
|
@ -2511,32 +2511,35 @@ namespace Beefy.widgets
|
||||||
case KeyCode.Delete:
|
case KeyCode.Delete:
|
||||||
if (mWidgetWindow.IsKeyDown(.Control))
|
if (mWidgetWindow.IsKeyDown(.Control))
|
||||||
{
|
{
|
||||||
if (mWidgetWindow.IsKeyDown(.Shift))
|
if (!CheckReadOnly())
|
||||||
{
|
{
|
||||||
|
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;
|
int startIdx = CursorTextPos;
|
||||||
CursorToLineEnd();
|
SelectRight(line, lineChar, true, false);
|
||||||
mSelection = EditSelection(CursorTextPos, startIdx);
|
mSelection = EditSelection(CursorTextPos, startIdx);
|
||||||
|
|
||||||
var action = new DeleteSelectionAction(this);
|
var action = new DeleteSelectionAction(this);
|
||||||
action.mMoveCursor = true;
|
action.mMoveCursor = true;
|
||||||
mData.mUndoManager.Add(action);
|
mData.mUndoManager.Add(action);
|
||||||
action.mCursorTextPos = (.)startIdx;
|
action.mCursorTextPos = (.)startIdx;
|
||||||
PhysDeleteSelection(true);
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue