From 7c88c179e190940ca1750f1f787b5ff03b57b960 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Tue, 22 Aug 2023 22:53:14 -0700 Subject: [PATCH] charselect: add emoji variations and new short codes section Move the shortcode aliases out from the various emoji category pages and into a new shortcode page. Add variations, such as skin tones, to the different emoji category pages. --- config/src/keyassignment.rs | 4 ++- docs/changelog.md | 4 +++ wezterm-gui/src/termwindow/charselect.rs | 37 +++++++++++++++++------- 3 files changed, 33 insertions(+), 12 deletions(-) diff --git a/config/src/keyassignment.rs b/config/src/keyassignment.rs index 0c4ee60d0..fe81741ff 100644 --- a/config/src/keyassignment.rs +++ b/config/src/keyassignment.rs @@ -365,6 +365,7 @@ pub enum CharSelectGroup { Flags, NerdFonts, UnicodeNames, + ShortCodes, } // next is default, previous is the reverse @@ -398,7 +399,8 @@ char_select_group_impl_next_prev! ( Symbols => Flags, Flags => NerdFonts, NerdFonts => UnicodeNames, - UnicodeNames => RecentlyUsed, + UnicodeNames => ShortCodes, + ShortCodes => RecentlyUsed, ); impl Default for CharSelectGroup { diff --git a/docs/changelog.md b/docs/changelog.md index 7c79a5465..146356389 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -23,6 +23,10 @@ As features stabilize some brief notes about them will accumulate here. #### Changed * The default for [front_end](config/lua/config/front_end.md) is now `WebGpu`. +* Added split out github short codes from the various charselect sections into + their own new Short Codes section. +* CharSelect now shows emoji variations such as skin tones +* Improved fuzzy matching performance in CharSelect #### New * [wezterm imgcat](cli/imgcat.md) now has `--position`, `--no-move-cursor` and diff --git a/wezterm-gui/src/termwindow/charselect.rs b/wezterm-gui/src/termwindow/charselect.rs index 4b041dbd5..eae7bec9a 100644 --- a/wezterm-gui/src/termwindow/charselect.rs +++ b/wezterm-gui/src/termwindow/charselect.rs @@ -168,26 +168,40 @@ fn build_aliases() -> Vec { Group::Symbols => CharSelectGroup::Symbols, Group::Flags => CharSelectGroup::Flags, }; - push( - &mut aliases, - Alias { - name: Cow::Borrowed(emoji.name()), - character: Character::Emoji(emoji), - group, - }, - ); - if let Some(short) = emoji.shortcode() { - if short != emoji.name() { + match emoji.skin_tones() { + Some(iter) => { + for entry in iter { + push( + &mut aliases, + Alias { + name: Cow::Borrowed(entry.name()), + character: Character::Emoji(entry), + group, + }, + ); + } + } + None => { push( &mut aliases, Alias { - name: Cow::Borrowed(short), + name: Cow::Borrowed(emoji.name()), character: Character::Emoji(emoji), group, }, ); } } + for short in emoji.shortcodes() { + push( + &mut aliases, + Alias { + name: Cow::Borrowed(short), + character: Character::Emoji(emoji), + group: CharSelectGroup::ShortCodes, + }, + ); + } } for (name, value) in crate::unicode_names::NAMES { @@ -400,6 +414,7 @@ impl CharSelector { CharSelectGroup::Flags => "Flags", CharSelectGroup::NerdFonts => "NerdFonts", CharSelectGroup::UnicodeNames => "Unicode", + CharSelectGroup::ShortCodes => "Short Codes", }; let mut elements = vec![Element::new(