Пример #1
0
 def resolved_current_char(self):
     ans = self.current_char
     if ans:
         if self.emoji_variation and is_emoji_presentation_base(ord(
                 ans[0])):
             ans += self.emoji_variation
     return ans
Пример #2
0
 def update_prompt(self) -> None:
     self.update_current_char()
     if self.current_char is None:
         c, color = '??', 'red'
         self.choice_line = ''
     else:
         c, color = self.current_char, 'green'
         if self.emoji_variation and is_emoji_presentation_base(ord(c[0])):
             c += self.emoji_variation
         self.choice_line = _('Chosen:') + ' {} U+{} {}'.format(
             colored(c, 'green'), hex(ord(c[0]))[2:], faint(styled(name(c) or '', italic=True)))
     self.prompt = self.prompt_template.format(colored(c, color))
Пример #3
0
 def safe_chr(codepoint):
     ans = chr(codepoint).encode('utf-8', 'replace').decode('utf-8')
     if self.emoji_variation and is_emoji_presentation_base(codepoint):
         ans += self.emoji_variation
     return ans