fix(thread): 修正标签页位置和鼠标事件处理

调整标签页显示位置从顶部到底部,并修复鼠标事件在底部标签栏的触发条件
This commit is contained in:
2025-08-31 21:14:02 +08:00
parent 66567ff6a8
commit 60f00f6dcb

View File

@@ -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