fix flashing text in terminal

This commit is contained in:
2024-10-08 09:43:26 +01:00
parent f98cf47988
commit 4910a2337b
2 changed files with 10 additions and 10 deletions

View File

@@ -14,12 +14,12 @@ func shell(global ArObject) {
go func() {
for sig := range c {
if sig == os.Interrupt {
fmt.Println("\x1b[0m\n\x1b[32;5;240mBye :)\x1b[0m")
fmt.Println("\x1b[0m\n\x1b[32;240mBye :)\x1b[0m")
os.Exit(0)
}
}
}()
fmt.Print("\x1b[32;5;240mWelcome to the Argon v3!\x1b[0m\n\n")
fmt.Print("\x1b[32;240mWelcome to the Argon v3!\x1b[0m\n\n")
for {
indent := 0
previous := 0
@@ -27,7 +27,7 @@ func shell(global ArObject) {
textBefore := ">>>"
for i := 1; indent > 0 || (previous != indent && indent >= 0) || i == 1; i++ {
indentStr := strings.Repeat(" ", indent)
code := indentStr + input("\x1b[38;5;240m"+textBefore+indentStr+" \x1b[0m\x1b[1;5;240m")
code := indentStr + input("\x1b[38;240m"+textBefore+indentStr+" \x1b[0m\x1b[1;240m")
fmt.Print("\x1b[0m")
totranslate = append(totranslate, UNPARSEcode{code, code, i, "<shell>"})
trimmed := strings.TrimSpace(code)

View File

@@ -42,7 +42,7 @@ func anyToArgon(x any, quote bool, simplify bool, depth int, indent int, colored
}
case number:
if colored {
output = append(output, "\x1b[34;5;240m")
output = append(output, "\x1b[34;240m")
}
num, _ := x.Float64()
if math.IsNaN(num) {
@@ -59,7 +59,7 @@ func anyToArgon(x any, quote bool, simplify bool, depth int, indent int, colored
}
case bool:
if colored {
output = append(output, "\x1b[35;5;240m")
output = append(output, "\x1b[35;240m")
}
output = append(output, strconv.FormatBool(x))
if colored {
@@ -67,7 +67,7 @@ func anyToArgon(x any, quote bool, simplify bool, depth int, indent int, colored
}
case nil:
if colored {
output = append(output, "\x1b[31;5;240m")
output = append(output, "\x1b[31;240m")
}
output = append(output, "null")
if colored {
@@ -128,7 +128,7 @@ func anyToArgon(x any, quote bool, simplify bool, depth int, indent int, colored
} else {
outputkeyval := []string{}
if colored {
outputkeyval = append(outputkeyval, "\x1b[36;5;240m")
outputkeyval = append(outputkeyval, "\x1b[36;240m")
}
outputkeyval = append(outputkeyval, key.(string))
if colored {
@@ -148,7 +148,7 @@ func anyToArgon(x any, quote bool, simplify bool, depth int, indent int, colored
output = append(output, anyToArgon(item, true, true, depth-1, indent+1, colored, plain))
}
if colored {
output = append(output, "\x1b[38;5;240m(...)\x1b[0m")
output = append(output, "\x1b[38;240m(...)\x1b[0m")
} else {
output = append(output, "(...)")
}
@@ -173,7 +173,7 @@ func anyToArgon(x any, quote bool, simplify bool, depth int, indent int, colored
return "[" + maybenewline + (strings.Repeat(" ", (indent+1)*plain)) + strings.Join(output, ","+maybenewline+(strings.Repeat(" ", (indent+1)*plain))) + maybenewline + (strings.Repeat(" ", indent*plain)) + "]"
case builtinFunc:
if colored {
output = append(output, "\x1b[38;5;240m")
output = append(output, "\x1b[38;240m")
}
output = append(output, "<builtin function "+x.name+">")
if colored {
@@ -181,7 +181,7 @@ func anyToArgon(x any, quote bool, simplify bool, depth int, indent int, colored
}
case Callable:
if colored {
output = append(output, "\x1b[38;5;240m")
output = append(output, "\x1b[38;240m")
}
output = append(output, "<function "+x.name+">")
if colored {