fix(lgui): 替换term.blink为颜色反转实现光标效果

由于CC Tweaked不支持term.blink,改用前景色和背景色反转的方式实现光标闪烁效果
This commit is contained in:
2025-09-03 14:10:10 +08:00
parent c9c98f6ba7
commit 130d71b8c7
2 changed files with 10 additions and 4 deletions

View File

@@ -320,9 +320,15 @@ function TextField:draw()
-- Draw cursor
if self.focused and self.enabled then
term.setCursorPos(self.x + self.cursorPosDisplay, self.y)
term.blink(true)
else
term.blink(false)
-- CC Tweaked doesn't support term.blink, so we'll invert the colors instead
local currentFg = term.getTextColor()
local currentBg = term.getBackgroundColor()
term.setTextColor(currentBg)
term.setBackgroundColor(currentFg)
term.write(" ")
term.setTextColor(currentFg)
term.setBackgroundColor(currentBg)
term.setCursorPos(self.x + self.cursorPosDisplay, self.y)
end
term.setTextColor(oldFg)