From 16ff0f0d292fc78c379f13b7d2df81ca096446aa Mon Sep 17 00:00:00 2001 From: Leonmmcoset Date: Sun, 31 Aug 2025 22:17:03 +0800 Subject: [PATCH] =?UTF-8?q?refactor(installer):=20=E5=B0=86=E9=A1=B6?= =?UTF-8?q?=E9=83=A8=E5=90=8D=E7=A7=B0=E6=A0=8F=E4=BB=A3=E7=A0=81=E7=A7=BB?= =?UTF-8?q?=E8=87=B3=E5=8A=A0=E8=BD=BD=E5=AE=8C=E6=88=90=E5=90=8E=E6=89=A7?= =?UTF-8?q?=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将顶部名称栏的显示逻辑从程序开头移动到模块加载完成后执行,使界面初始化更合理 --- installer.lua | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/installer.lua b/installer.lua index 65bfea1..9becf61 100644 --- a/installer.lua +++ b/installer.lua @@ -1,24 +1,5 @@ -- LeonOS installer --- 程序顶部名称栏 -local term = require("term") -local colors = require("colors") - --- 保存当前颜色设置 -local old_fg = term.getTextColor() -local old_bg = term.getBackgroundColor() - --- 设置名称栏颜色并显示 -term.setTextColor(colors.white) -term.setBackgroundColor(colors.cyan) -term.at(1, 1).clearLine() -term.at(1, 1).write("=== LeonOS Installer ===") - --- 恢复颜色设置 -term.setTextColor(old_fg) -term.setBackgroundColor(old_bg) -term.at(1, 2) - local DEFAULT_ROM_DIR = "/rc" term.at(1, 2).write("Start loading LeonOS installer...\n") term.write("[Installer] Loading module 1\n") @@ -82,6 +63,23 @@ local function progress(y, a, b) colors.yellow, "]") end term.write("[Installer] Loading done.\n") +-- 程序顶部名称栏 +local term = require("term") +local colors = require("colors") +-- 保存当前颜色设置 +local old_fg = term.getTextColor() +local old_bg = term.getBackgroundColor() + +-- 设置名称栏颜色并显示 +term.setTextColor(colors.white) +term.setBackgroundColor(colors.cyan) +term.at(1, 1).clearLine() +term.at(1, 1).write("=== LeonOS Installer ===") + +-- 恢复颜色设置 +term.setTextColor(old_fg) +term.setBackgroundColor(old_bg) +term.at(1, 2) -- 只清除顶栏以下的区域 for y=2, term.getSize() do term.at(1, y).clearLine()