CSI m Character Attributes (SGR)
(params []string)
| 896 | // CSI m |
| 897 | // Character Attributes (SGR) |
| 898 | func (t *Terminal) sgrSequenceHandler(params []string) bool { |
| 899 | |
| 900 | if len(params) == 0 { |
| 901 | params = []string{"0"} |
| 902 | } |
| 903 | |
| 904 | for i := range params { |
| 905 | |
| 906 | p := strings.Replace(strings.Replace(params[i], "[", "", -1), "]", "", -1) |
| 907 | |
| 908 | switch p { |
| 909 | case "00", "0", "": |
| 910 | attr := t.GetActiveBuffer().getCursorAttr() |
| 911 | *attr = CellAttributes{} |
| 912 | case "1", "01": |
| 913 | t.GetActiveBuffer().getCursorAttr().bold = true |
| 914 | case "2", "02": |
| 915 | t.GetActiveBuffer().getCursorAttr().dim = true |
| 916 | case "3", "03": |
| 917 | t.GetActiveBuffer().getCursorAttr().italic = true |
| 918 | case "4", "04": |
| 919 | t.GetActiveBuffer().getCursorAttr().underline = true |
| 920 | case "5", "05": |
| 921 | t.GetActiveBuffer().getCursorAttr().blink = true |
| 922 | case "7", "07": |
| 923 | t.GetActiveBuffer().getCursorAttr().inverse = true |
| 924 | case "8", "08": |
| 925 | t.GetActiveBuffer().getCursorAttr().hidden = true |
| 926 | case "9", "09": |
| 927 | t.GetActiveBuffer().getCursorAttr().strikethrough = true |
| 928 | case "21": |
| 929 | t.GetActiveBuffer().getCursorAttr().bold = false |
| 930 | case "22": |
| 931 | t.GetActiveBuffer().getCursorAttr().dim = false |
| 932 | case "23": |
| 933 | t.GetActiveBuffer().getCursorAttr().italic = false |
| 934 | case "24": |
| 935 | t.GetActiveBuffer().getCursorAttr().underline = false |
| 936 | case "25": |
| 937 | t.GetActiveBuffer().getCursorAttr().blink = false |
| 938 | case "27": |
| 939 | t.GetActiveBuffer().getCursorAttr().inverse = false |
| 940 | case "28": |
| 941 | t.GetActiveBuffer().getCursorAttr().hidden = false |
| 942 | case "29": |
| 943 | t.GetActiveBuffer().getCursorAttr().strikethrough = false |
| 944 | case "38": // set foreground |
| 945 | t.GetActiveBuffer().getCursorAttr().fgColour, _ = t.theme.ColourFromAnsi(params[i+1:], false) |
| 946 | return false |
| 947 | case "48": // set background |
| 948 | t.GetActiveBuffer().getCursorAttr().bgColour, _ = t.theme.ColourFromAnsi(params[i+1:], true) |
| 949 | return false |
| 950 | case "39": |
| 951 | t.GetActiveBuffer().getCursorAttr().fgColour = t.theme.DefaultForeground() |
| 952 | case "49": |
| 953 | t.GetActiveBuffer().getCursorAttr().bgColour = t.theme.DefaultBackground() |
| 954 | default: |
| 955 | bi, err := strconv.Atoi(p) |
no test coverage detected