From 130d71b8c7197706e2f5a2f39a63d11aaa2f2e7f Mon Sep 17 00:00:00 2001 From: Leonmmcoset Date: Wed, 3 Sep 2025 14:10:10 +0800 Subject: [PATCH] =?UTF-8?q?fix(lgui):=20=E6=9B=BF=E6=8D=A2term.blink?= =?UTF-8?q?=E4=B8=BA=E9=A2=9C=E8=89=B2=E5=8F=8D=E8=BD=AC=E5=AE=9E=E7=8E=B0?= =?UTF-8?q?=E5=85=89=E6=A0=87=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 由于CC Tweaked不支持term.blink,改用前景色和背景色反转的方式实现光标闪烁效果 --- data/computercraft/lua/rom/apis/lgui.lua | 12 +++++++++--- installer.lua | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/data/computercraft/lua/rom/apis/lgui.lua b/data/computercraft/lua/rom/apis/lgui.lua index 3a3d84b..80538ff 100644 --- a/data/computercraft/lua/rom/apis/lgui.lua +++ b/data/computercraft/lua/rom/apis/lgui.lua @@ -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) diff --git a/installer.lua b/installer.lua index 0dfe950..24c837f 100644 --- a/installer.lua +++ b/installer.lua @@ -1,5 +1,5 @@ -- 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" print("Start loading LeonOS installer ("..INSTALLER_VERSION..")...")