1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-27 12:23:46 +03:00

remove use of cluster cell idx in ls-fonts

This commit is contained in:
Wez Furlong 2021-07-08 07:25:35 -07:00
parent b08a6ab5ef
commit 33c87611dc

View File

@ -440,21 +440,21 @@ pub fn run_ls_fonts(config: config::ConfigHandle, cmd: &LsFontsCommand) -> anyho
let infos = font.shape(&cluster.text, || {}, |_| {}).unwrap(); let infos = font.shape(&cluster.text, || {}, |_| {}).unwrap();
for info in infos { for info in infos {
let cell_idx = cluster.byte_to_cell_idx(info.cluster as usize);
let cells = &line.cells()[cell_idx..][..info.num_cells as usize];
let text = cells.iter().map(|c| c.str()).collect::<String>();
let parsed = &handles[info.font_idx]; let parsed = &handles[info.font_idx];
let escaped = format!("{}", text.escape_unicode()); let escaped = format!("{}", cluster.text.escape_unicode());
if config.custom_block_glyphs { if config.custom_block_glyphs {
if let Some(block) = glyphcache::BlockKey::from_str(&text) { if let Some(block) = glyphcache::BlockKey::from_str(&text) {
println!("{:4} {:12} drawn by wezterm: {:?}", text, escaped, block); println!(
"{:4} {:12} drawn by wezterm: {:?}",
cluster.text, escaped, block
);
continue; continue;
} }
} }
println!( println!(
"{:4} {:12} glyph={:<4} {}\n{:29}{}", "{:4} {:12} glyph={:<4} {}\n{:29}{}",
text, cluster.text,
escaped, escaped,
info.glyph_pos, info.glyph_pos,
parsed.lua_name(), parsed.lua_name(),