Skip to content

Commit

Permalink
BugFix: 修复issue-1168中条件不充分的问题,redoing进行判断
Browse files Browse the repository at this point in the history
  • Loading branch information
ACFancy committed Nov 16, 2021
1 parent 1a0a6a5 commit 4e8944f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions QMUIKit/QMUIComponents/QMUITextField.m
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,9 @@ - (void)handleTextChangeEvent:(QMUITextField *)textField {
// 1、iOS 10 以下的版本,从中文输入法的候选词里选词输入,是不会走到 textField:shouldChangeCharactersInRange:replacementString: 的,所以要在这里截断文字
// 2、如果是中文输入法正在输入拼音的过程中(markedTextRange 不为 nil),是不应该限制字数的(例如输入“huang”这5个字符,其实只是为了输入“黄”这一个字符),所以在 shouldChange 那边不会限制,而是放在 didChange 这里限制。

// 系统的三指撤销在文本框达到最大字符长度限制时可能引发 crash
// 系统的三指撤销或者重做在文本框达到最大字符长度限制时可能引发 crash
// https://github.com/Tencent/QMUI_iOS/issues/1168
if (textField.maximumTextLength < NSUIntegerMax && textField.undoManager.undoing) {
if (textField.maximumTextLength < NSUIntegerMax && (textField.undoManager.undoing || textField.undoManager.redoing)) {
return;
}

Expand Down
4 changes: 2 additions & 2 deletions QMUIKit/QMUIComponents/QMUITextView.m
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,9 @@ - (void)handleTextChanged:(id)sender {
[self updatePlaceholderLabelHidden];
}

// 系统的三指撤销在文本框达到最大字符长度限制时可能引发 crash
// 系统的三指撤销或者重做在文本框达到最大字符长度限制时可能引发 crash
// https://github.com/Tencent/QMUI_iOS/issues/1168
if (textView.maximumTextLength < NSUIntegerMax && textView.undoManager.undoing) {
if (textView.maximumTextLength < NSUIntegerMax && (textView.undoManager.undoing || textView.undoManager.redoing)) {
return;
}

Expand Down

0 comments on commit 4e8944f

Please sign in to comment.