mirror of
https://mzte.de/git/LordMZTE/dotfiles.git
synced 2024-12-14 12:23:40 +01:00
wezterm: properly calculate tab element length
This commit is contained in:
parent
e40f93fd5f
commit
6b51f1d273
1 changed files with 7 additions and 2 deletions
|
@ -50,6 +50,11 @@
|
|||
tab.tab_title tab.active_pane.title)
|
||||
bg (fn [t] (if t.is_active :#cba6f7 :#313244))
|
||||
fg (fn [t] (if t.is_active :#181825 :#cdd6f4))
|
||||
not-first? (~= tab.tab_index 0)
|
||||
last? (= tab.tab_index (- (length tabs) 1))
|
||||
deco-len (+ 2
|
||||
(if not-first? 1 0)
|
||||
(if last? 2 0))
|
||||
elems []]
|
||||
;; first tab
|
||||
(when (~= tab.tab_index 0)
|
||||
|
@ -59,7 +64,7 @@
|
|||
|
||||
(table.insert elems {:Background {:Color (bg tab)}})
|
||||
(table.insert elems {:Foreground {:Color (fg tab)}})
|
||||
(table.insert elems {:Text (.. " " (string.sub title 1 (math.min (- max_width 6) (length title))) " ")})
|
||||
(table.insert elems {:Text (.. " " (string.sub title 1 (math.min (- max_width deco-len) (length title))) " ")})
|
||||
|
||||
;; last tab
|
||||
(when (= tab.tab_index (- (length tabs) 1))
|
||||
|
|
Loading…
Reference in a new issue