From 210e602057bc95043c2fd6060a506aadde4aaea5 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Tue, 16 Mar 2021 21:16:17 +0800 Subject: [PATCH] =?UTF-8?q?cmd=E6=96=B0=E5=A2=9E=E5=A4=8D=E5=88=B6?= =?UTF-8?q?=E5=92=8C=E5=89=AA=E5=88=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/scenes/app_cmd.lua | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/parts/scenes/app_cmd.lua b/parts/scenes/app_cmd.lua index bce4db6e..e54037b0 100644 --- a/parts/scenes/app_cmd.lua +++ b/parts/scenes/app_cmd.lua @@ -455,6 +455,23 @@ end +local combKey={} +function combKey.x() + love.system.setClipboardText(inputBox.value) + inputBox.value="" + SFX.play("reach") +end +function combKey.c() + love.system.setClipboardText(inputBox.value) + SFX.play("reach") +end +function combKey.v() + inputBox.value=inputBox.value..love.system.getClipboardText() + SFX.play("reach") +end + + + --Environment for user's function local noLog=false local function log_user(str) @@ -583,8 +600,6 @@ function scene.keyDown(k) inputBox.value="" end end - elseif k=="escape"then - WIDGET.sel=inputBox elseif k=="tab"then local str=inputBox.value if str~=""and not str:find("%s")then @@ -605,8 +620,10 @@ function scene.keyDown(k) inputBox.value=res[1] end end - elseif k=="v"and kb.isDown("lctrl","rctrl")then - inputBox.value=inputBox.value..love.system.getClipboardText() + elseif combKey[k]and kb.isDown("lctrl","rctrl")then + combKey[k]() + elseif k=="escape"then + WIDGET.sel=inputBox else WIDGET.keyPressed(k) end