added cut/copy/paste text support for Windows keys

This commit is contained in:
thrust26 2020-10-11 10:46:49 +02:00
parent 76c526bcb0
commit a021005b4e
3 changed files with 44 additions and 5 deletions

View File

@ -1883,9 +1883,9 @@
<tr><td>Control + w</td><td>Remove entire word to left of cursor</td></tr>
<tr><td>Control + Left</td><td>Move cursor to beginning of word to the left</td></tr>
<tr><td>Control + Right</td><td>Move cursor to beginning of word to the right</td></tr>
<tr><td>Control + c</td><td>Copy entire line to clipboard</td></tr>
<tr><td>Control + v</td><td>Paste clipboard contents</td></tr>
<tr><td>Control + x</td><td>Cut entire line to clipboard</td></tr>
<tr><td>Control + c, Control + Insert</td><td>Copy entire line to clipboard</td></tr>
<tr><td>Control + v, Shift + Insert</td><td>Paste clipboard contents</td></tr>
<tr><td>Control + x, Shift + Delete</td><td>Cut entire line to clipboard</td></tr>
</table>
</blockquote></br>

View File

@ -337,6 +337,9 @@ bool PromptWidget::handleKeyDown(StellaKey key, StellaMod mod)
case KBDK_DELETE:
case KBDK_KP_PERIOD: // actually the num delete
if(StellaModTest::isShift(mod))
textCut();
else
killChar(+1);
dirty = true;
break;
@ -444,6 +447,21 @@ bool PromptWidget::handleKeyDown(StellaKey key, StellaMod mod)
dirty = true;
break;
case KBDK_INSERT:
if(StellaModTest::isShift(mod))
{
textPaste();
dirty = true;
}
else if(StellaModTest::isControl(mod))
{
textCopy();
dirty = true;
}
else
handled = false;
break;
default:
if (StellaModTest::isControl(mod))
{

View File

@ -138,6 +138,12 @@ bool EditableWidget::handleKeyDown(StellaKey key, StellaMod mod)
case KBDK_DELETE:
case KBDK_KP_PERIOD:
if(StellaModTest::isShift(mod))
{
cutSelectedText();
dirty = true;
}
else
dirty = killChar(+1);
if(dirty) sendCommand(EditableWidget::kChangedCmd, key, _id);
break;
@ -164,6 +170,21 @@ bool EditableWidget::handleKeyDown(StellaKey key, StellaMod mod)
dirty = setCaretPos(int(_editString.size()));
break;
case KBDK_INSERT:
if(StellaModTest::isControl(mod))
{
copySelectedText();
dirty = true;
}
else if(StellaModTest::isShift(mod))
{
pasteSelectedText();
dirty = true;
}
else
handled = false;
break;
default:
if (StellaModTest::isControl(mod))
{