parseEscapeSequence 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.
(s string)
| 105 | // converts it to a [tcell.Style] object. |
| 106 | // Legacy function that only accepts SGR. Kept for convenience. |
| 107 | func parseEscapeSequence(s string) tcell.Style { |
| 108 | s = strings.TrimPrefix(s, "\033[") |
| 109 | if i := strings.IndexByte(s, 'm'); i >= 0 { |
| 110 | s = s[:i] |
| 111 | } |
| 112 | return applySGR(s, tcell.StyleDefault) |
| 113 | } |
| 114 | |
| 115 | // applyTermSequence takes an escape sequence (e.g. `\033[1m`) and applies it |
| 116 | // to the given [tcell.Style] object. |