mirror of
https://github.com/wez/wezterm.git
synced 2024-09-11 22:37:11 +03:00
ls-fonts: emulate the effect of normalize_output_to_unicode_nfc
This aids in debugging: ``` ; wezterm --config normalize_output_to_unicode_nfc=false ls-fonts --text $(echo a$'\u301\u302') LeftToRight 0 x_adv=8 cells=1 glyph=aacute,190 wezterm.font("JetBrains Mono", {weight="Regular", stretch="Normal", style="Normal"}) /usr/share/fonts/jetbrains-mono-fonts/JetBrainsMono-Regular.otf, FontConfig 0 á̂ \u{61}\u{301}\u{302} x_adv=0 cells=0 glyph=uni0302,1646 wezterm.font("JetBrains Mono", {weight="Regular", stretch="Normal", style="Normal"}) /usr/share/fonts/jetbrains-mono-fonts/JetBrainsMono-Regular.otf, FontConfig ``` ``` ; ./target/debug/wezterm --config normalize_output_to_unicode_nfc=true ls-fonts --text $(echo a$'\u301\u302') LeftToRight 0 x_adv=8 cells=1 glyph=aacute,190 wezterm.font("JetBrains Mono", {weight="Regular", stretch="Normal", style="Normal"}) /usr/share/fonts/jetbrains-mono-fonts/JetBrainsMono-Regular.otf, FontConfig 0 á̂ \u{e1}\u{302} x_adv=0 cells=0 glyph=uni0302,1646 wezterm.font("JetBrains Mono", {weight="Regular", stretch="Normal", style="Normal"}) /usr/share/fonts/jetbrains-mono-fonts/JetBrainsMono-Regular.otf, FontConfig ``` refs: #3093
This commit is contained in:
parent
f224ed4cc5
commit
73f50efb7f
@ -25,6 +25,7 @@ use std::rc::Rc;
|
||||
use std::sync::Arc;
|
||||
use termwiz::cell::{CellAttributes, UnicodeVersion};
|
||||
use termwiz::surface::{Line, SEQ_ZERO};
|
||||
use unicode_normalization::UnicodeNormalization;
|
||||
use wezterm_bidi::Direction;
|
||||
use wezterm_client::domain::{ClientDomain, ClientDomainConfig};
|
||||
use wezterm_font::shaper::PresentationWidth;
|
||||
@ -866,8 +867,15 @@ pub fn run_ls_fonts(config: config::ConfigHandle, cmd: &LsFontsCommand) -> anyho
|
||||
};
|
||||
|
||||
if let Some(text) = &text {
|
||||
// Emulate the effect of output normalization
|
||||
let text = if config.normalize_output_to_unicode_nfc {
|
||||
text.nfc().collect()
|
||||
} else {
|
||||
text.to_string()
|
||||
};
|
||||
|
||||
let line = Line::from_text(
|
||||
text,
|
||||
&text,
|
||||
&CellAttributes::default(),
|
||||
SEQ_ZERO,
|
||||
Some(unicode_version),
|
||||
|
Loading…
Reference in New Issue
Block a user