Skip to content

[Bug]: emojis rendered inside tmux cause first characters of next line to start at end of current line #3395

Description

@duppypro

Current Behavior

Experiment running a temporary tmux server with debug logging returned:
utf8proc_wcwidth(1F451) returned 2

This is a classic multiplexer desync bug:

  1. Tmux thinks 👑 is 2 columns wide. (Correct)
  2. Pi TUI thinks 👑 is 2 columns wide. (Correct)
  3. WaveTerm's layout/width engine thinks 👑 is 1 column wide, but its font renders the glyph across 2 columns
    anyway. (Incorrect)

Why this causes chaos:

  • Directly outside tmux: There is no multiplexer virtual grid to sync. Node.js outputs sequential bytes,
    WaveTerm places them next to each other, and you only see a minor, imperceptible 1-column layout shift (like a
    box border being slightly short). No overlap, looks fine.
  • Inside tmux: Tmux maintains a strict virtual grid buffer and optimizes redraws. Because WaveTerm's width
    engine and tmux's width engine disagree, tmux's optimized cursor updates place characters directly on top of
    the second half of the emoji glyph, causing overlapping text and chaotic wrapped lines!

────────────────────────────────────────────────────────────────────────────────

How to Fix (WaveTerm Settings on your Host):

Open WaveTerm's settings tab (Cmd + , or Ctrl + , or click the gear icon):

  1. Unicode Version: Set to 11 or higher (optimally 15).
  2. East Asian Ambiguous: Toggle the setting to treat ambiguous-width characters as double-width (2 columns).
  3. Font: Ensure you're using a strictly monospaced font with correct emoji width support (e.g., JetBrains Mono,
    Fira Code, Hack, or SF Mono).

Expected Behavior

print the following using !printf to the pi TUI while in tmux:

  1. Tmux thinks 👑 is 2 columns wide. (Correct)
  2. Pi TUI thinks 👑 is 2 columns wide. (Correct)
  3. WaveTerm's layout/width engine thinks 👑 is 1 column wide, but its font renders the glyph across 2 columns
    anyway. (Incorrect)

It will render as:

print the following using !printf to the pi TUI while in tmux:

 1. Tmux thinks 👑 is 2 columns wide. (Correct)
2. Pi TUI thinks 👑 is 2 columns wide. (Correct)                                                                                                              3
. WaveTerm's layout/width engine thinks 👑 is 1 column wide, but its font renders the glyph across 2 columns
    anyway. (Incorrect)

Steps To Reproduce

print the following using !printf to the pi TUI while in tmux:

  1. Tmux thinks 👑 is 2 columns wide. (Correct)
  2. Pi TUI thinks 👑 is 2 columns wide. (Correct)
  3. WaveTerm's layout/width engine thinks 👑 is 1 column wide, but its font renders the glyph across 2 columns
    anyway. (Incorrect)

Wave Version

v0.14.5

Platform

Windows

OS Version/Distribution

Win 11

Architecture

x64

Anything else?

I am ssh'd from Windows Powershell terminal widget into a VPS running Ubuntu. Then run tmux, then run pi coding agent within tmux.
But I think you can repo without pi

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriageNeeds triage

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions