Projects STRLCPY fzf Commits 209d5e8e
🤬
  • ■ ■ ■ ■ ■ ■
    src/ansi.go
    skipped 106 lines
    107 107   // ^ match starting here
    108 108   //
    109 109   i := 2 // prefix matched in nextAnsiEscapeSequence()
    110  - for ; i < len(s) && (isNumeric(s[i]) || s[i] == ';' || s[i] == ':' || s[i] == '?'); i++ {
    111  - }
    112  - if i < len(s) {
     110 + for ; i < len(s); i++ {
    113 111   c := s[i]
    114  - if 'a' <= c && c <= 'z' || 'A' <= c && c <= 'Z' || c == '@' {
    115  - return i + 1
     112 + switch c {
     113 + case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ';', ':', '?':
     114 + // ok
     115 + default:
     116 + if 'a' <= c && c <= 'z' || 'A' <= c && c <= 'Z' || c == '@' {
     117 + return i + 1
     118 + }
     119 + return -1
    116 120   }
    117 121   }
    118 122   return -1
    119 123  }
    120 124   
    121 125  func isCtrlSeqStart(c uint8) bool {
    122  - return c == '\\' || c == '[' || c == '(' || c == ')'
     126 + switch c {
     127 + case '\\', '[', '(', ')':
     128 + return true
     129 + }
     130 + return false
    123 131  }
    124 132   
    125 133  // nextAnsiEscapeSequence returns the ANSI escape sequence and is equivalent to
    skipped 296 lines
Please wait...
Page is in error, reload to recover