             }
             
             codes.append(codesString)
-            //            index = index.successor()
+            index = string.index(after: index)
             outer = String(string.characters[index])
         }
         

        }
        
        let codes = codesString.characters.split(separator: ";", maxSplits: Int.max, omittingEmptySubsequences: false).flatMap { UInt8(String($0)) }
        
        let startIndex = index
        
        let endIndex = string.index(string.endIndex, offsetBy: -"\(token)0m".characters.count)

    typealias ResultType = UInt8
    func extractModeCodes(string: String) -> (codes: [UInt8], text: String) {
        let token = ControlCode.CSI
        var index = string.index(string.startIndex, offsetBy: token.characters.count)
        var codesString = ""
        while string.characters[index] != "m" {
