feat: START box for launch lines and blank line between boxes

This commit is contained in:
lzrdblzzrd committed 2026-10-04 20:05:40 +03:00
1 parent e391138337
commit ef0dc08bcd
2 files changed
+38 -18

No files matched your search

+26 -18
View File
@@ -701,20 +701,12 @@ func (a *app) emitChange(hasGame bool, target uint32, detail string) {
// flushScan выводит события одного скана одним боксом.
// Порядок групп строгий: PROMOTE -> DEMOTE -> SKIP -> BLOCK.
func (a *app) flushScan() {
a.buffering = false
groups := []struct {
name string
rows []string
}{
{"PROMOTE", a.bufPromote},
{"DEMOTE", a.bufDemote},
{"SKIP", a.bufSkip},
{"BLOCK", a.bufBlock},
}
head := a.gameHead
a.gameHead = ""
a.bufPromote, a.bufDemote, a.bufSkip, a.bufBlock = nil, nil, nil, nil
type logGroup struct {
name string
rows []string
}
func renderBox(head string, groups []logGroup) {
var lines []string
if head != "" {
lines = append(lines, "├ "+head)
@@ -756,6 +748,21 @@ func (a *app) flushScan() {
logRaw(line)
}
logRaw("└" + strings.Repeat("─", width-1))
logRaw("")
}
func (a *app) flushScan() {
a.buffering = false
head := a.gameHead
a.gameHead = ""
groups := []logGroup{
{"PROMOTE", a.bufPromote},
{"DEMOTE", a.bufDemote},
{"SKIP", a.bufSkip},
{"BLOCK", a.bufBlock},
}
a.bufPromote, a.bufDemote, a.bufSkip, a.bufBlock = nil, nil, nil, nil
renderBox(head, groups)
}
// handleTrigger проводит триггер через смену приоритета, но вместо
@@ -1088,8 +1095,8 @@ func main() {
fmt.Fprintln(logFile, s)
}
logf("autoPriority started (mem=%s, game-mem=%s, interval=%s, dry-run=%v)",
formatMemSize(mem), formatMemSize(gameMem), *interval, *dryRun)
startRows := []string{fmt.Sprintf("started (mem=%s, game-mem=%s, interval=%s, dry-run=%v)",
formatMemSize(mem), formatMemSize(gameMem), *interval, *dryRun)}
if !*dryRun {
pid := uint32(os.Getpid())
@@ -1099,11 +1106,12 @@ func main() {
closeH(h)
}
if err != nil {
logf("warning: could not set own priority to IDLE: %v", err)
startRows = append(startRows, fmt.Sprintf("warning: could not set own priority to IDLE: %v", err))
} else {
logf("own priority set to IDLE")
startRows = append(startRows, "own priority set to IDLE")
}
}
renderBox("", []logGroup{{"START", startRows}})
a := newApp(mem, gameMem, *dryRun)