diff --git a/src/emoji-matcher.lisp b/src/emoji-matcher.lisp index 75b8cbb..a80ffe7 100644 --- a/src/emoji-matcher.lisp +++ b/src/emoji-matcher.lisp @@ -61,7 +61,7 @@ ;;;; expansion of (gen-matcher-sequences) (defun emoji-sequences-p (chars) - (find-if (lambda (a) (match-codepoint-p chars a)) + (member-if (lambda (a) (match-codepoint-p chars a)) '((#\U1F9DD #\EMOJI_MODIFIER_FITZPATRICK_TYPE-6) (#\U1F9DD #\EMOJI_MODIFIER_FITZPATRICK_TYPE-5) (#\U1F9DD #\EMOJI_MODIFIER_FITZPATRICK_TYPE-4) @@ -1817,7 +1817,7 @@ ;;;; expansion of (gen-matcher-zwj-sequences) (defun emoji-zwj-sequences-p (chars) - (find-if (lambda (a) (match-codepoint-p chars a)) + (member-if (lambda (a) (match-codepoint-p chars a)) '((#\U1F9D1 #\ZERO_WIDTH_JOINER #\CHRISTMAS_TREE) (#\FACE_WITHOUT_MOUTH #\ZERO_WIDTH_JOINER #\FOG #\VARIATION_SELECTOR-16) @@ -4749,5 +4749,8 @@ (defgeneric emojip (codepoints-chars)) (defmethod emojip ((codepoints-chars list)) - (or (emoji-zwj-sequences-p codepoints-chars) - (emoji-sequences-p codepoints-chars))) + (first (or (emoji-zwj-sequences-p codepoints-chars) + (emoji-sequences-p codepoints-chars)))) + +(defun starts-with-emoji-p (codepoints-chars) + (emojip codepoints-chars)) diff --git a/src/gemini-viewer.lisp b/src/gemini-viewer.lisp index f402fbc..75a2c85 100644 --- a/src/gemini-viewer.lisp +++ b/src/gemini-viewer.lisp @@ -341,12 +341,10 @@ (response-body (gemini-client:slurp-gemini-url favicon-url)) (favicon-list (coerce (babel:octets-to-string response-body :errorp t) 'list)) - (non-emoji-pos (position-if (lambda (a) (not (emojip (list a)))) - favicon-list)) - (favicon (if non-emoji-pos - (coerce (subseq favicon-list 0 non-emoji-pos) - 'string) - (coerce favicon-list 'string)))) + (emoji (starts-with-emoji-p favicon-list)) + (favicon (if emoji + (coerce emoji 'string) + (swconf:gemini-default-favicon)))) (setf cache (acons host favicon cache)) (fetch-favicon parsed-url))) (swconf:gemini-default-favicon))))))) diff --git a/src/package.lisp b/src/package.lisp index 2bc647d..6bac647 100644 --- a/src/package.lisp +++ b/src/package.lisp @@ -392,7 +392,8 @@ :maybe-percent-encode :display-corrupting-utf8-p :remove-corrupting-utf8-chars - :emojip)) + :emojip + :starts-with-emoji-p)) (defpackage :html-utils (:use