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 -- Draw cursor
if self.focused and self.enabled then if self.focused and self.enabled then
term.setCursorPos(self.x + self.cursorPosDisplay, self.y) term.setCursorPos(self.x + self.cursorPosDisplay, self.y)
term.blink(true) -- CC Tweaked doesn't support term.blink, so we'll invert the colors instead
else local currentFg = term.getTextColor()
term.blink(false) 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 end
term.setTextColor(oldFg) term.setTextColor(oldFg)

View File

@@ -1,5 +1,5 @@
-- LeonOS installer -- LeonOS installer
local INSTALLER_VERSION = "0.3.8 Beta 3 Alpha 2" local INSTALLER_VERSION = "0.3.8 Beta 3 Alpha 3"
local DEFAULT_ROM_DIR = "/leonos" local DEFAULT_ROM_DIR = "/leonos"
print("Start loading LeonOS installer ("..INSTALLER_VERSION..")...") print("Start loading LeonOS installer ("..INSTALLER_VERSION..")...")