From a021005b4ed00bc479e79fd1edc7a1a6c83cfea9 Mon Sep 17 00:00:00 2001 From: thrust26 Date: Sun, 11 Oct 2020 10:46:49 +0200 Subject: [PATCH] added cut/copy/paste text support for Windows keys --- docs/index.html | 6 +++--- src/debugger/gui/PromptWidget.cxx | 20 +++++++++++++++++++- src/gui/EditableWidget.cxx | 23 ++++++++++++++++++++++- 3 files changed, 44 insertions(+), 5 deletions(-) diff --git a/docs/index.html b/docs/index.html index d2d7b8e6f..e7c7c0889 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1883,9 +1883,9 @@ Control + wRemove entire word to left of cursor Control + LeftMove cursor to beginning of word to the left Control + RightMove cursor to beginning of word to the right - Control + cCopy entire line to clipboard - Control + vPaste clipboard contents - Control + xCut entire line to clipboard + Control + c, Control + InsertCopy entire line to clipboard + Control + v, Shift + InsertPaste clipboard contents + Control + x, Shift + DeleteCut entire line to clipboard
diff --git a/src/debugger/gui/PromptWidget.cxx b/src/debugger/gui/PromptWidget.cxx index 9b3c1bca9..75fede786 100644 --- a/src/debugger/gui/PromptWidget.cxx +++ b/src/debugger/gui/PromptWidget.cxx @@ -337,7 +337,10 @@ bool PromptWidget::handleKeyDown(StellaKey key, StellaMod mod) case KBDK_DELETE: case KBDK_KP_PERIOD: // actually the num delete - killChar(+1); + 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)) { diff --git a/src/gui/EditableWidget.cxx b/src/gui/EditableWidget.cxx index 72b88d565..77bcd58a8 100644 --- a/src/gui/EditableWidget.cxx +++ b/src/gui/EditableWidget.cxx @@ -138,7 +138,13 @@ bool EditableWidget::handleKeyDown(StellaKey key, StellaMod mod) case KBDK_DELETE: case KBDK_KP_PERIOD: - dirty = killChar(+1); + 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)) {