From 60f00f6dcbb1c8dc50ef1cadc99d15b969ac753c Mon Sep 17 00:00:00 2001 From: Leonmmcoset Date: Sun, 31 Aug 2025 21:14:02 +0800 Subject: [PATCH] =?UTF-8?q?fix(thread):=20=E4=BF=AE=E6=AD=A3=E6=A0=87?= =?UTF-8?q?=E7=AD=BE=E9=A1=B5=E4=BD=8D=E7=BD=AE=E5=92=8C=E9=BC=A0=E6=A0=87?= =?UTF-8?q?=E4=BA=8B=E4=BB=B6=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 调整标签页显示位置从顶部到底部,并修复鼠标事件在底部标签栏的触发条件 --- .../lua/rom/modules/main/rc/thread.lua | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/data/computercraft/lua/rom/modules/main/rc/thread.lua b/data/computercraft/lua/rom/modules/main/rc/thread.lua index 7ecdd94..9258c57 100644 --- a/data/computercraft/lua/rom/modules/main/rc/thread.lua +++ b/data/computercraft/lua/rom/modules/main/rc/thread.lua @@ -184,7 +184,7 @@ local function redraw() if #tabs > 1 then local len = -scroll + 1 - wrappedNative.setCursorPos(1, 1) + wrappedNative.setCursorPos(1, h) wrappedNative.setTextColor(colors.black) wrappedNative.setBackgroundColor(colors.gray) wrappedNative.clearLine() @@ -193,7 +193,7 @@ local function redraw() local tab = tabs[i] local name = names[i] - wrappedNative.setCursorPos(len, 1) + wrappedNative.setCursorPos(len, h) len = len + #name if i == focused then @@ -208,20 +208,20 @@ local function redraw() end tab.term.setVisible(false) - tab.term.reposition(1, 2, w, h - 1) + tab.term.reposition(1, 1, w, h - 1) end if totalNameLength > w-2 then wrappedNative.setTextColor(colors.black) wrappedNative.setBackgroundColor(colors.gray) if scroll > 0 then - wrappedNative.setCursorPos(1, 1) + wrappedNative.setCursorPos(1, h) wrappedNative.write("<") end if totalNameLength - scroll > w-1 then - wrappedNative.setCursorPos(w, 1) + wrappedNative.setCursorPos(w, h) wrappedNative.write(">") - end + end end tabs[focused].term.setVisible(true) @@ -253,7 +253,7 @@ local function processEvent(event) if #event > 3 then -- mouse event if #tabs > 1 then - if event[4] == 1 then + if event[4] == h then local curX = -scroll if event[1] == "mouse_scroll" then