From 14c0cdf40afabcfe2a65a85a7daac9715603e9cf Mon Sep 17 00:00:00 2001 From: s-vartak Date: Mon, 16 May 2016 21:38:38 +0530 Subject: [PATCH] Hakawai: FEEDUI-12763, Fixed assertion failure, cleared implicit-mention's buffer string when cursor position changes. Repro steps: 1) Add mention at beginning. 2) After the mention, add white space then 3 chars (i.e " aaa"). 3) Tap on mention, type a character in the range of first 3 characters. (You may need to move cursor position by dragging to reach at the specified location). 4) App will crash. Fix: - When user change the cursor position by tapping, implicit-mention's buffer string was not being cleared when new cursor position lies in the range of mention or just after mention. - It resulted in an assertion failure "Logic error: prefixLength would make the location of the mention negative". - Fixed it by using cursorMovedWithCharacterNowPrecedingCursor() even when tapped on mention or just after mention. It ultimately clears the implicit-mention's buffer. --- Hakawai/Mentions/HKWMentionsPlugin.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Hakawai/Mentions/HKWMentionsPlugin.m b/Hakawai/Mentions/HKWMentionsPlugin.m index 7660dd0..3d69be1 100644 --- a/Hakawai/Mentions/HKWMentionsPlugin.m +++ b/Hakawai/Mentions/HKWMentionsPlugin.m @@ -1275,8 +1275,8 @@ - (void)advanceStateForInsertionChanged:(unichar)precedingChar // No mention [self resetCurrentMentionsData]; self.state = HKWMentionsStateQuiescent; - [self.startDetectionStateMachine cursorMovedWithCharacterNowPrecedingCursor:precedingChar]; } + [self.startDetectionStateMachine cursorMovedWithCharacterNowPrecedingCursor:precedingChar]; break; } case HKWMentionsStateSelectedMention: {