修改键盘长按立即清空和撤销删除

This commit is contained in:
2025-12-26 11:47:44 +08:00
parent 8e934dd83a
commit 203f104ece
28 changed files with 798 additions and 71 deletions

View File

@@ -27,6 +27,7 @@
#import "KBBizCode.h"
#import "KBBackspaceLongPressHandler.h"
#import "KBBackspaceUndoManager.h"
#import "KBInputBufferManager.h"
@interface KBFunctionView () <KBFunctionBarViewDelegate, KBStreamOverlayViewDelegate, KBFunctionTagListViewDelegate>
// UI
@@ -721,6 +722,8 @@ static void KBULDarwinCallback(CFNotificationCenterRef center, void *observer, C
// - / changeCount
- (void)startPasteboardMonitor {
//
return;
// 访宿/
if (![[KBFullAccessManager shared] hasFullAccess]) return;
if (self.pasteboardTimer) return;
@@ -775,9 +778,11 @@ static void KBULDarwinCallback(CFNotificationCenterRef center, void *observer, C
NSLog(@"点击:删除");
UIInputViewController *ivc = KBFindInputViewController(self);
id<UITextDocumentProxy> proxy = ivc.textDocumentProxy;
[[KBBackspaceUndoManager shared] recordDeletionSnapshotBefore:proxy.documentContextBeforeInput
after:proxy.documentContextAfterInput];
[proxy deleteBackward];
[[KBInputBufferManager shared] refreshFromProxyIfPossible:proxy];
[[KBInputBufferManager shared] prepareSnapshotForDeleteWithContextBefore:proxy.documentContextBeforeInput
after:proxy.documentContextAfterInput];
[[KBBackspaceUndoManager shared] captureAndDeleteBackwardFromProxy:proxy count:1];
[[KBInputBufferManager shared] applyHoldDeleteCount:1];
}
- (void)onTapClear {
NSLog(@"点击:清空");
@@ -791,6 +796,7 @@ static void KBULDarwinCallback(CFNotificationCenterRef center, void *observer, C
UIInputViewController *ivc = KBFindInputViewController(self);
id<UITextDocumentProxy> proxy = ivc.textDocumentProxy;
[proxy insertText:@"\n"];
[[KBInputBufferManager shared] appendText:@"\n"];
}
#pragma mark - Lazy