Skip to content

Commit

Permalink
charselect: add emoji variations and new short codes section
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
wez committed Aug 23, 2023
1 parent c7cc3e4 commit 7c88c17
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 12 deletions.
4 changes: 3 additions & 1 deletion config/src/keyassignment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ pub enum CharSelectGroup {
Flags,
NerdFonts,
UnicodeNames,
ShortCodes,
}

// next is default, previous is the reverse
Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 4 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
37 changes: 26 additions & 11 deletions wezterm-gui/src/termwindow/charselect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,26 +168,40 @@ fn build_aliases() -> Vec<Alias> {
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 {
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 7c88c17

Please sign in to comment.