Module: Unicode::DisplayWidth::EmojiSupport

Defined in:
lib/unicode/display_width/emoji_support.rb

Class Method Summary collapse

Class Method Details



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/unicode/display_width/emoji_support.rb', line 18

def self._recommended
  if ENV["CI"]
    return :rqi
  end

  case ENV["TERM_PROGRAM"]
  when "iTerm.app"
    return :all
  when "Apple_Terminal"
    return :rgi_at
  when "WezTerm"
    return :all_no_vs16
  end

  case ENV["TERM"]
  when "contour","foot"
    # konsole: all, how to detect?
    return :all
  when /kitty/
    return :vs16
  end

  if ENV["WT_SESSION"] # Windows Terminal
    return :vs16
  end

  # As of last time checked: gnome-terminal, vscode, alacritty
  :none
end

Tries to find out which terminal emulator is used to set emoji: config to best suiting value

Please also see section in README.md and misc/terminal-emoji-width.rb

Please note: Many terminals do not set any ENV vars, maybe CSI queries can help?



14
15
16
# File 'lib/unicode/display_width/emoji_support.rb', line 14

def self.recommended
  @recommended ||= _recommended
end