This commit is contained in:
2025-11-12 17:55:59 +08:00
parent 2f4205ad1a
commit 66b7a9218e
2 changed files with 18 additions and 2 deletions

View File

@@ -289,6 +289,15 @@ static NSUInteger kb_validUTF8PrefixLen(NSData *data) {
- (void)emitChunk:(NSString *)rawText {
if (rawText.length == 0) return;
NSString *text = rawText;
// 0) \r/\n "\n\t""\r\n\t""\r\t" "\t"
text = [text stringByReplacingOccurrencesOfString:@"\r\n\t" withString:@"\t"];
text = [text stringByReplacingOccurrencesOfString:@"\n\t" withString:@"\t"];
text = [text stringByReplacingOccurrencesOfString:@"\r\t" withString:@"\t"];
while (text.length > 0) {
unichar c0 = [text characterAtIndex:0];
if (c0 == '\n' || c0 == '\r') { text = [text substringFromIndex:1]; continue; }
break;
}
// 1) /t -> \t
if (self.treatSlashTAsTab) {
text = [text stringByReplacingOccurrencesOfString:@"/t" withString:@"\t"];