summaryrefslogtreecommitdiffstats
path: root/default-plugins/tab-bar/src/line.rs
diff options
context:
space:
mode:
Diffstat (limited to 'default-plugins/tab-bar/src/line.rs')
-rw-r--r--default-plugins/tab-bar/src/line.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/default-plugins/tab-bar/src/line.rs b/default-plugins/tab-bar/src/line.rs
index be5623ff9..af78b0fcf 100644
--- a/default-plugins/tab-bar/src/line.rs
+++ b/default-plugins/tab-bar/src/line.rs
@@ -1,4 +1,5 @@
use ansi_term::ANSIStrings;
+use unicode_width::UnicodeWidthStr;
use crate::{LinePart, ARROW_SEPARATOR};
use zellij_tile::prelude::*;
@@ -100,7 +101,7 @@ fn left_more_message(tab_count_to_the_left: usize, palette: Palette, separator:
};
// 238
// chars length plus separator length on both sides
- let more_text_len = more_text.chars().count() + 2 * separator.chars().count();
+ let more_text_len = more_text.width() + 2 * separator.width();
let left_separator = style!(palette.cyan, palette.orange).paint(separator);
let more_styled_text = style!(palette.black, palette.orange)
.bold()
@@ -130,7 +131,7 @@ fn right_more_message(
" +many → ".to_string()
};
// chars length plus separator length on both sides
- let more_text_len = more_text.chars().count() + 2 * separator.chars().count();
+ let more_text_len = more_text.width() + 2 * separator.width();
let left_separator = style!(palette.cyan, palette.orange).paint(separator);
let more_styled_text = style!(palette.black, palette.orange)
.bold()
@@ -159,7 +160,7 @@ fn tab_line_prefix(session_name: Option<&str>, palette: Palette, cols: usize) ->
}];
if let Some(name) = session_name {
let name_part = format!("({}) ", name);
- let name_part_len = name_part.chars().count();
+ let name_part_len = name_part.width();
let name_part_styled_text = style!(palette.white, palette.cyan).bold().paint(name_part);
if cols.saturating_sub(prefix_text_len) >= name_part_len {
parts.push(LinePart {