From 136341feefacd6175fb1c065c38a54715e30bb8f Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Tue, 16 Mar 2021 21:04:11 +0800 Subject: [PATCH] =?UTF-8?q?cmd=E6=96=B0=E5=A2=9Etab=E8=A1=A5=E5=85=A8?= =?UTF-8?q?=E5=92=8C=E7=B2=98=E8=B4=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/scenes/app_cmd.lua | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/parts/scenes/app_cmd.lua b/parts/scenes/app_cmd.lua index 18b34d2d..bce4db6e 100644 --- a/parts/scenes/app_cmd.lua +++ b/parts/scenes/app_cmd.lua @@ -1,4 +1,5 @@ local gc=love.graphics +local kb=love.keyboard local int=math.floor local ins,rem=table.insert,table.remove local C=COLOR @@ -584,6 +585,28 @@ function scene.keyDown(k) end elseif k=="escape"then WIDGET.sel=inputBox + elseif k=="tab"then + local str=inputBox.value + if str~=""and not str:find("%s")then + local res={} + for c in next,commands do + if c:find(str,nil,true)==1 then + ins(res,c) + end + end + + if #res>1 then + log(">Commands start with '"..str.."' :") + table.sort(res) + for i=1,#res do + log{COLOR.lGrey,res[i]} + end + elseif #res==1 then + inputBox.value=res[1] + end + end + elseif k=="v"and kb.isDown("lctrl","rctrl")then + inputBox.value=inputBox.value..love.system.getClipboardText() else WIDGET.keyPressed(k) end