bug修复

This commit is contained in:
2026-02-11 19:40:41 +08:00
parent 0144f9cc6d
commit f0cb69948e

View File

@@ -102,6 +102,7 @@ static void KBSkinInstallNotificationCallback(CFNotificationCenterRef center,
@property(nonatomic, strong) NSMutableArray<KBChatMessage *> *chatMessages;
@property(nonatomic, strong) AVAudioPlayer *chatAudioPlayer;
@property(nonatomic, assign) BOOL chatPanelVisible;
@property(nonatomic, copy) NSString *chatPanelBaselineText; // 宿
@property(nonatomic, strong, nullable) id kb_fullAccessObserverToken;
@property(nonatomic, strong, nullable) id kb_skinObserverToken;
@end
@@ -563,6 +564,9 @@ static NSString *KBFormatMB(uint64_t bytes) {
}
self.chatPanelVisible = show;
if (show) {
// 宿
[[KBInputBufferManager shared] refreshFromProxyIfPossible:self.textDocumentProxy];
self.chatPanelBaselineText = [KBInputBufferManager shared].liveText ?: @"";
[self kb_ensureChatPanelViewIfNeeded];
self.chatPanelView.hidden = NO;
self.chatPanelView.alpha = 0.0;
@@ -1033,7 +1037,15 @@ static NSString *KBFormatMB(uint64_t bytes) {
return;
}
[[KBInputBufferManager shared] refreshFromProxyIfPossible:self.textDocumentProxy];
NSString *rawText = [KBInputBufferManager shared].liveText ?: @"";
NSString *fullText = [KBInputBufferManager shared].liveText ?: @"";
// 宿线
NSString *baseline = self.chatPanelBaselineText ?: @"";
NSString *rawText = fullText;
if (baseline.length > 0 && [fullText hasPrefix:baseline]) {
rawText = [fullText substringFromIndex:baseline.length];
}
NSString *trim =
[rawText stringByTrimmingCharactersInSet:
[NSCharacterSet whitespaceAndNewlineCharacterSet]];
@@ -1042,6 +1054,7 @@ static NSString *KBFormatMB(uint64_t bytes) {
return;
}
[self kb_sendChatText:trim];
// 线
[self kb_clearHostInputForText:rawText];
}