refactor: move optionToFmtstr() to termseq.go (#2323)

This commit is contained in:
CatsDeservePets authored and GitHub committed 2025-12-27 17:37:30 +01:00
1 parent eb01cb7c7b
commit 57d02dd01d
4 files changed
+26 -26

No files matched your search

+10
View File
@@ -85,6 +85,16 @@ func readTermSequence(s string) string {
}
}
// This function takes an escape sequence option (e.g. `\033[1m`) and outputs a
// complete format string (e.g. `\033[1m%s\033[0m`).
func optionToFmtstr(optstr string) string {
if !strings.Contains(optstr, "%s") {
return optstr + "%s\033[0m"
} else {
return optstr
}
}
// This function takes an escape sequence option (e.g. `\033[1m`) and converts
// it to a `tcell.Style` object.
// Legacy function that only accepts SGR. Kept for convenience.