commit 3b08037dfb53030644a87250cf833b3fcd8f57a8
parent d5397f3db8df7a21f9c70868ca16b67155d896ce
Author: Iqbal Ansari <iqbalansari02@yahoo.com>
Date: Sun, 18 Sep 2016 11:33:41 +0530
Handle an edge case while searching for composed text
`next-single-property-change` returns the limit itself if it does not
find a text with given property, this was causing an error in the
display loop for displaying composed text. Similarly default to region
end if we fail to find the end of the composed text
Diffstat:
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/emojify.el b/emojify.el
@@ -1043,10 +1043,16 @@ should not be a problem 🤞."
'composition
nil
end))))
- (while (and (> end (point)) compose-start)
+ (while (and (> end (point))
+ ;; `end' would be equal to `compose-start' if there was no
+ ;; text with composition found within `end', this happens
+ ;; because `next-single-property-change' returns the limit
+ ;; (and we use `end' as the limit) if no match is found
+ (> end compose-start)
+ compose-start)
(let* ((match (emojify--get-composed-text compose-start))
(emoji (emojify-get-emoji match))
- (compose-end (next-single-property-change compose-start 'composition)))
+ (compose-end (next-single-property-change compose-start 'composition nil end)))
;; Display only composed text that is unicode char
(when (and emoji
(string= (gethash "style" emoji) "unicode"))