Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some emojis break urwid-based TUI with tmux #205

Open
maximbaz opened this issue Jan 30, 2022 · 1 comment
Open

Some emojis break urwid-based TUI with tmux #205

maximbaz opened this issue Jan 30, 2022 · 1 comment

Comments

@maximbaz
Copy link
Contributor

maximbaz commented Jan 30, 2022

Hello,

I was trying out https://github.com/isamert/scli when I noticed that UI often gets corrupted when emojis are involved, and it turns out z4h is somewhat to blame 🙂

I believe I managed to get consistent repro steps down to a small script below, so you won't need to install too many dependencies. To reproduce, you only need urwid installed, and then save this script (say in /tmp/repro.py) which has the important bits from scli:

import urwid


class StatusLine(urwid.WidgetWrap):
    def __init__(self, unread_count=0):
        self._text = urwid.Text("Left: ")
        self._unreads_widget = urwid.Text("Right: 0")
        self._status_cols = urwid.Columns(
            [self._text, ("pack", self._unreads_widget)], dividechars=1
        )
        placeholder = urwid.WidgetPlaceholder(self._status_cols)
        super().__init__(placeholder)

    def set_text(self, new_text):
        self._text.set_text(self._text.text + new_text)


def keypress(key):
    status_line.set_text("🟩")


fill = urwid.Filler(urwid.Text("Hello World"))
status_line = StatusLine()
w = urwid.Frame(fill, footer=status_line)

loop = urwid.MainLoop(w, unhandled_input=keypress)
loop.run()

Now:

  • kitty --config NONE
  • z4h up-to-date
  • .zshrc containing just one line z4h init || return
  • Run python /tmp/repro.py - you will see status bar with Left: and Right: 0 in the bottom row.
  • Press Space, an emoji is drawn on the left side in the bottom row.

Expected: nothing changes on the screen, except the appearance of the emoji symbol.
Actual: The entire screen, all rows, get moved up by one row.

Finally:

  • If you keep pressing Space, things will get progressively worse.
  • Add zstyle ':z4h:' start-tmux no to your .zshrc - the bug will no longer reproduce.
@romkatv
Copy link
Owner

romkatv commented Feb 2, 2022

Thanks for filing the bug and providing a lot of information. I appreciate it.

This bug unfortunately falls under the category of bugs that I won't be looking into: #35 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants