dj95 / zjstatus

A configurable statusbar plugin for zellij
MIT License
358 stars 6 forks source link

Second format string in {mode} handler not recognized #23

Closed mike-lloyd03 closed 7 months ago

mike-lloyd03 commented 7 months ago

Describe the bug If a second format string is used when defining a {mode} handler, it is rendered as text

To Reproduce Steps to reproduce the behavior: Define mode_* fields as such:

mode_normal        "#[fg=#1a1c23,bg=#4fa6ed,bold] NORMAL  #[fg=#4fa6ed,bg=#4fa6ed]"
mode_locked        "#[fg=#1a1c23,bg=#8ebd6b,bold] LOCKED  #[fg=#8ebd6b,bg=#4fa6ed]"
...

(The missing character there is the slant character from the "slanted style" example)

A new zellij session renders the mode widget with the second format string as text.

Expected behavior The second format string should be rendered.

Screenshots image

Desktop (please complete the following information):

Layout

How does the layout look like? Please copy it into a code block.

layout {
    pane split_direction="vertical" {
        pane
    }

    pane size=1 borderless=true {
        plugin location="file:/home/mike/.config/zellij/plugins/zjstatus.wasm" {
            format_left  "{mode}#[fg=#1a1c23,bg=#4fa6ed,bold]{session}  #[fg=#4fa6ed,bg=#1a1c23]{tabs}"
            format_right "#[fg=#1a1c23,bg=#4fa6ed,bold]{datetime}"
            format_space "#[bg=#1a1c23]"

            border_enabled  "false"

            hide_frame_for_single_pane "true"

            tab_normal              "#[fg=#1a1c23,bg=#4C4C59] #[fg=#000000,bg=#4C4C59]{index}  {name} #[fg=#4C4C59,bg=#1a1c23]"
            tab_normal_fullscreen   "#[fg=#1a1c23,bg=#4C4C59] #[fg=#000000,bg=#4C4C59]{index}  {name} Z #[fg=#4C4C59,bg=#1a1c23]"
            tab_normal_fullscreen   "#[fg=#1a1c23,bg=#4C4C59] #[fg=#000000,bg=#4C4C59]{index}  {name} S #[fg=#4C4C59,bg=#1a1c23]"
            tab_active              "#[fg=#1a1c23,bg=#ffffff,bold] {index}  {name} #[fg=#ffffff,bg=#1a1c23]"
            tab_active_fullscreen   "#[fg=#1a1c23,bg=#ffffff,bold] {index}  {name} Z #[fg=#ffffff,bg=#1a1c23]"
            tab_active_fullscreen   "#[fg=#1a1c23,bg=#ffffff,bold] {index}  {name} S #[fg=#ffffff,bg=#1a1c23]"

            datetime        "#[fg=#1a1c23,bg=#4fa6ed,bold] {format} "
            datetime_format "%A, %d %b %Y %H:%M"
            datetime_timezone "America/Los_Angeles"

            mode_normal        "#[fg=#1a1c23,bg=#4fa6ed,bold] NORMAL  #[fg=#4fa6ed,bg=#4fa6ed]"
            mode_locked        "#[fg=#1a1c23,bg=#8ebd6b,bold] LOCKED  #[fg=#8ebd6b,bg=#4fa6ed]"
            mode_resize        "#[fg=#1a1c23,bg=#8ebd6b,bold] RESIZE  #[fg=#8ebd6b,bg=#4fa6ed]"
            mode_pane          "#[fg=#1a1c23,bg=#8ebd6b,bold] PANE    #[fg=#8ebd6b,bg=#4fa6ed]"
            mode_tab           "#[fg=#1a1c23,bg=#8ebd6b,bold] TAB     #[fg=#8ebd6b,bg=#4fa6ed]"
            mode_scroll        "#[fg=#1a1c23,bg=#8ebd6b,bold] SCROLL  #[fg=#8ebd6b,bg=#4fa6ed]"
            mode_enter_search  "#[fg=#1a1c23,bg=#8ebd6b,bold] ENTER SEARCH #[fg=#8ebd6b,bg=#4fa6ed]"
            mode_search        "#[fg=#1a1c23,bg=#8ebd6b,bold] SEARCH  #[fg=#8ebd6b,bg=#4fa6ed]"
            mode_rename_tab    "#[fg=#1a1c23,bg=#8ebd6b,bold] RENAME TAB #[fg=#8ebd6b,bg=#4fa6ed]"
            mode_rename_pane   "#[fg=#1a1c23,bg=#8ebd6b,bold] RENAME PANE #[fg=#8ebd6b,bg=#4fa6ed]"
            mode_session       "#[fg=#1a1c23,bg=#8ebd6b,bold] SESSION #[fg=#8ebd6b,bg=#4fa6ed]"
            mode_move          "#[fg=#1a1c23,bg=#8ebd6b,bold] MOVE    #[fg=#8ebd6b,bg=#4fa6ed]"
            mode_prompt        "#[fg=#1a1c23,bg=#8ebd6b,bold] PROMPT  #[fg=#8ebd6b,bg=#4fa6ed]"
            mode_tmux          "#[fg=#1a1c23,bg=#8ebd6b,bold] TMUX    #[fg=#8ebd6b,bg=#4fa6ed]"
        }
    }
}
dj95 commented 7 months ago

Hey,

thanks for the bug report, only the tab widget was meant to process multiple formats. I've implemented it in v0.9.1 also for the mode widget, since I can see the use case there. Other widgets are not able to process multiple formats. However, I might consider implementing it in the future.