mirror of
https://github.com/daylinmorgan/hwylterm.git
synced 2024-11-16 06:28:32 -06:00
fix style insensitivity
Some checks failed
GitHub Pages / build (push) Has been cancelled
GitHub Pages / deploy (push) Has been cancelled
Some checks failed
GitHub Pages / build (push) Has been cancelled
GitHub Pages / deploy (push) Has been cancelled
This commit is contained in:
parent
773f393e3d
commit
7e82f7ba5a
2 changed files with 2 additions and 2 deletions
|
@ -39,7 +39,7 @@ let bbMode* = checkColorSupport()
|
|||
let colorSystem* = checkColorSystem()
|
||||
|
||||
func firstCapital(s: string): string = s.toLowerAscii().capitalizeAscii()
|
||||
func normalizeStyle(style: string): string = style.replace("_","").capitalizeAscii()
|
||||
func normalizeStyle(style: string): string = style.replace("_","").toLowerAscii().capitalizeAscii()
|
||||
func isHex(s: string): bool = (s.startswith "#") and (s.len == 7)
|
||||
|
||||
func toCode(style: BbStyle): string = $ord(style)
|
||||
|
@ -77,7 +77,6 @@ proc toAnsiCode*(s: string): string =
|
|||
styles = s.splitWhitespace()
|
||||
for style in styles:
|
||||
let normalizedStyle = normalizeStyle(style)
|
||||
|
||||
if normalizedStyle in ["B", "I", "U"]:
|
||||
codes.add parseEnum[BbStyleAbbr](normalizedStyle).toCode()
|
||||
elif normalizedStyle in BbStyleNames:
|
||||
|
|
|
@ -47,6 +47,7 @@ suite "basic":
|
|||
test "style insensitive":
|
||||
bbCheck "[red]no case sensitivity[/RED]", "\e[38;5;1mno case sensitivity\e[0m"
|
||||
bbCheck "[bright_red]should be BrightRed[/]", "\e[38;5;9mshould be BrightRed\e[0m"
|
||||
bbCheck "[BrightRed]should be BrightRed[/]", "\e[38;5;9mshould be BrightRed\e[0m"
|
||||
|
||||
test "style full":
|
||||
check "[red]Red[/red]".bb == bb("Red", "red")
|
||||
|
|
Loading…
Reference in a new issue