Add 3 line operation (delete, copy & cut) shortcuts
* Shift-Delete: without selected text, it will delete the whole line. * Ctrl-C: without selected text, it will copy the whole line. * Ctrl-X: without selected text, it will cut the whole line. Fix #14296, close #14298pull/14329/head
parent
b5730eea31
commit
e9c50ed967
|
@ -484,7 +484,7 @@ LRESULT ScintillaEditView::scintillaNew_Proc(HWND hwnd, UINT Message, WPARAM wPa
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case WM_KEYUP :
|
case WM_KEYUP:
|
||||||
{
|
{
|
||||||
if (wParam == VK_PRIOR || wParam == VK_NEXT)
|
if (wParam == VK_PRIOR || wParam == VK_NEXT)
|
||||||
{
|
{
|
||||||
|
@ -499,10 +499,13 @@ LRESULT ScintillaEditView::scintillaNew_Proc(HWND hwnd, UINT Message, WPARAM wPa
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case WM_KEYDOWN :
|
case WM_KEYDOWN:
|
||||||
{
|
{
|
||||||
if ((execute(SCI_GETSELECTIONMODE) == SC_SEL_RECTANGLE) || (execute(SCI_GETSELECTIONMODE) == SC_SEL_THIN))
|
if ((execute(SCI_GETSELECTIONMODE) == SC_SEL_RECTANGLE) || (execute(SCI_GETSELECTIONMODE) == SC_SEL_THIN))
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
// Transform the column selection to multi-edit
|
||||||
|
//
|
||||||
switch (wParam)
|
switch (wParam)
|
||||||
{
|
{
|
||||||
case VK_LEFT:
|
case VK_LEFT:
|
||||||
|
@ -524,6 +527,49 @@ LRESULT ScintillaEditView::scintillaNew_Proc(HWND hwnd, UINT Message, WPARAM wPa
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Add 3 shortcuts:
|
||||||
|
// Shift + Delete: without selected text, it will delete the whole line.
|
||||||
|
// Ctrl + C: without selected text, it will copy the whole line.
|
||||||
|
// Ctrl + X: without selected text, it will cut the whole line.
|
||||||
|
//
|
||||||
|
switch (wParam)
|
||||||
|
{
|
||||||
|
case VK_DELETE:
|
||||||
|
{
|
||||||
|
SHORT shift = GetKeyState(VK_SHIFT);
|
||||||
|
if (shift & 0x8000)
|
||||||
|
{
|
||||||
|
bool hasSelection = (execute(SCI_GETSELECTIONSTART) != execute(SCI_GETSELECTIONEND));
|
||||||
|
if (!hasSelection)
|
||||||
|
{
|
||||||
|
execute(SCI_LINEDELETE);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'C':
|
||||||
|
case 'X':
|
||||||
|
{
|
||||||
|
SHORT ctrl = GetKeyState(VK_CONTROL);
|
||||||
|
if (ctrl & 0x8000)
|
||||||
|
{
|
||||||
|
bool hasSelection = (execute(SCI_GETSELECTIONSTART) != execute(SCI_GETSELECTIONEND));
|
||||||
|
if (!hasSelection)
|
||||||
|
{
|
||||||
|
execute(wParam == 'C' ? SCI_LINECOPY : SCI_LINECUT);
|
||||||
|
//return TRUE;
|
||||||
|
// No return and let Scintilla procedure to continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue