Commit 0dfdf628 by Jake Boxer

Handle two possible emoji in a row

parent 4344fabd
......@@ -26,7 +26,7 @@ module Rumoji
last_emoji = previous_emoji.pop
sequence = if last_emoji.nil? || !last_emoji.codepoints.include?(codepoint)
if possible_emoji.empty?
if possible_emoji.empty? || last_emoji
last_codepoint = last_emoji && last_emoji.codepoints.first
sequence_codepoints = [last_codepoint, codepoint].compact
sequence_codepoints.pack("U" * sequence_codepoints.size)
......
......@@ -31,7 +31,7 @@ describe Rumoji do
end
it "keeps codepoints that match the beginnings of multi-codepoint emoji" do
text = "i like #hashtags and 1direction"
text = "i like #hashtags and 1direction they are the #1 band"
io = StringIO.new(text)
Rumoji.encode_io(io).string.must_equal text
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment