From 076d854f1178fb3c562e3d11acf09c5f46d9f52a Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Fri, 25 Jun 2021 23:41:06 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E8=B0=83=E6=96=87=E6=9C=AC=E6=A1=86?= =?UTF-8?q?=E6=8E=A7=E4=BB=B6=E6=BB=9A=E5=8A=A8=E6=9D=A1=E4=BB=B6=EF=BC=8C?= =?UTF-8?q?=E5=BE=AE=E8=B0=83=E8=81=94=E7=BD=91=E6=B8=B8=E6=88=8F=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E8=A1=8C=E4=B8=BA=EF=BC=8C=E5=BE=AE=E8=B0=83=E6=8E=A7?= =?UTF-8?q?=E5=88=B6=E5=8F=B0=E8=BE=93=E5=87=BA=E7=A9=BA=E8=A1=8C=E7=9A=84?= =?UTF-8?q?=E6=97=B6=E6=9C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zframework/widget.lua | 4 ++-- parts/scenes/app_console.lua | 6 +++--- parts/scenes/main.lua | 1 - 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Zframework/widget.lua b/Zframework/widget.lua index 8d80ca93..d943c02b 100644 --- a/Zframework/widget.lua +++ b/Zframework/widget.lua @@ -923,8 +923,8 @@ function textBox:update() end function textBox:push(t) ins(self.texts,t) - if self.scrollPos==#self.texts-1 then - self.scrollPos=#self.texts + if self.scrollPos==(#self.texts-1-self.capacity)*self.lineH then--minus 1 for the new message + self.scrollPos=min(self.scrollPos+self.lineH,(#self.texts-self.capacity)*self.lineH) end end function textBox:press(x,y) diff --git a/parts/scenes/app_console.lua b/parts/scenes/app_console.lua index 3f7cf8b3..77ed85cf 100644 --- a/parts/scenes/app_console.lua +++ b/parts/scenes/app_console.lua @@ -846,9 +846,6 @@ function scene.keyDown(key) if history[27]then rem(history,1)end hisPtr=nil - --Insert empty line - log"" - --Execute if input:byte()==35 then --Execute lua code @@ -882,6 +879,9 @@ function scene.keyDown(key) end end inputBox:clear() + + --Insert empty line + log"" elseif key=="up"then if not hisPtr then hisPtr=#history diff --git a/parts/scenes/main.lua b/parts/scenes/main.lua index 3ddcf5bb..f6e33db8 100644 --- a/parts/scenes/main.lua +++ b/parts/scenes/main.lua @@ -70,7 +70,6 @@ function scene.keyDown(key,isRep) if testButton(3)then if WS.status('app')=='running'then NET.tryLogin(false) - MES.new('info',text.wsConnecting) elseif WS.status('app')=='dead'then NET.wsconn_app() SFX.play('connect')