diff --git a/CustomKeyboard/KeyboardViewControllerHelp/KeyboardViewController+Chat.m b/CustomKeyboard/KeyboardViewControllerHelp/KeyboardViewController+Chat.m index d2f9ced..c0a52ed 100644 --- a/CustomKeyboard/KeyboardViewControllerHelp/KeyboardViewController+Chat.m +++ b/CustomKeyboard/KeyboardViewControllerHelp/KeyboardViewController+Chat.m @@ -93,13 +93,25 @@ static const NSUInteger kKBChatMessageLimit = 6; NSString *trim = [rawText stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]]; + NSString *textToClear = rawText; + if (trim.length == 0) { + // 兼容「先输入再打开聊天面板」场景: + // 此时新增文本为空,但当前输入框已有可发送内容,应该允许直接发送。 + NSString *fullTrim = + [fullText stringByTrimmingCharactersInSet: + [NSCharacterSet whitespaceAndNewlineCharacterSet]]; + if (fullTrim.length > 0) { + trim = fullTrim; + textToClear = fullText; + } + } if (trim.length == 0) { [KBHUD showInfo:KBLocalized(@"请输入内容")]; return; } [self kb_sendChatText:trim]; - // 只清除新增的文本,保留基线文本 - [self kb_clearHostInputForText:rawText]; + // 默认只清新增文本;若命中兜底则清当前全文,避免“已发送但输入框残留”。 + [self kb_clearHostInputForText:textToClear]; } - (void)kb_sendChatText:(NSString *)text { diff --git a/_DerivedData/Logs/Package/18A75CB0-3C97-4594-BAD8-E9270D999989.xcactivitylog b/_DerivedData/Logs/Package/18A75CB0-3C97-4594-BAD8-E9270D999989.xcactivitylog new file mode 100644 index 0000000..3a4ffb2 Binary files /dev/null and b/_DerivedData/Logs/Package/18A75CB0-3C97-4594-BAD8-E9270D999989.xcactivitylog differ diff --git a/_DerivedData/Logs/Package/C9B2536F-0143-4FD7-90C7-C8F37E9F59D6.xcactivitylog b/_DerivedData/Logs/Package/C9B2536F-0143-4FD7-90C7-C8F37E9F59D6.xcactivitylog deleted file mode 100644 index b180a2f..0000000 Binary files a/_DerivedData/Logs/Package/C9B2536F-0143-4FD7-90C7-C8F37E9F59D6.xcactivitylog and /dev/null differ diff --git a/keyBoard.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/keyBoard.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..0c67376 --- /dev/null +++ b/keyBoard.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,5 @@ + + + + + diff --git a/keyBoard.xcworkspace/xcuserdata/mac.xcuserdatad/WorkspaceSettings.xcsettings b/keyBoard.xcworkspace/xcuserdata/mac.xcuserdatad/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..bbfef02 --- /dev/null +++ b/keyBoard.xcworkspace/xcuserdata/mac.xcuserdatad/WorkspaceSettings.xcsettings @@ -0,0 +1,14 @@ + + + + + BuildLocationStyle + UseAppPreferences + CustomBuildLocationType + RelativeToDerivedData + DerivedDataLocationStyle + Default + ShowSharedSchemesAutomaticallyEnabled + + +