Skip to content

tmux 3.4 can shift an emoji neighbor in an exact pane capture #120

Backlog

Description

@tony

Summary

capture-pane on tmux 3.4 emits an extra space after an airplane plus emoji presentation selector. Libvt imports that space and certifies the shifted neighbor as exact.

Reproduction

  1. From the tagged libvt checkout, install the locked development dependencies with uv sync --frozen --python 3.14 --all-groups --all-extras. Use the checkout root as the working directory. Install the tmux version in Environment. Set TMUX_BIN to its executable when using a version outside your search path.

  2. Save the following as case.py at the checkout root.

import contextlib
import os
import subprocess
import tempfile
import time
from pathlib import Path

from libvt.contrib.tmux import build_tmux_capture_command, tmux_profile

def until(read, check):
    end = time.monotonic() + 6
    while True:
        value = read()
        if check(value):
            return value
        if time.monotonic() >= end:
            raise AssertionError(f"native wait expired at {value!r}")
        time.sleep(0.02)

@contextlib.contextmanager
def pane(width=24, height=6):
    binary = os.environ.get("TMUX_BIN", "tmux")
    version = subprocess.check_output([binary, "-V"], text=True).strip()
    with tempfile.TemporaryDirectory() as tmp:
        pipe = Path(tmp) / "log"
        os.mkfifo(pipe)
        argv = [binary, "-u", "-S", tmp + "/socket", "-f", "/dev/null"]
        def tm(*args):
            return subprocess.check_output([*argv, *args], timeout=6, stderr=subprocess.PIPE)
        def capture():
            bundle = build_tmux_capture_command("%0", tmux_version=version)
            return bundle.parse(tm(*bundle.argv), profile=tmux_profile(version))
        tm("new-session", "-d", "-x", str(width), "-y", str(height), "-s", "desk", "cat", str(pipe))
        try:
            tm("set", "-g", "status", "off")
            tm("set", "-w", "window-size", "manual")
            tm("resize-window", "-t", "%0", "-x", str(width), "-y", str(height))
            with pipe.open("wb", buffering=0) as feed:
                yield tm, feed.write, capture, argv, version
        finally:
            subprocess.run([*argv, "kill-server"], capture_output=True, check=False)

with pane() as (tm, write, capture, argv, version):
    write("✈️Z".encode())
    until(lambda: tm("capture-pane", "-p"), lambda b: b"Z" in b)
    result = capture()
    native_col = int(tm("display-message", "-p", "-t", "%0", "#{cursor_x}")) - 1
    col = next(i for i, cell in enumerate(result.snapshot[0]) if cell.text == "Z")
    print("native Z column", native_col, "captured Z column", col, "exact", result.completeness.exact_cells)
  1. Run the case.
$ uv run --no-sync python case.py

Expected

A pane capture can expose this native limitation to consumers comparing individual cells.

Actual

The native cursor places Z at zero-based column 2. In the captured snapshot Z is at column 3 and exact_cells is true. This build-specific behavior begins in the native capture stream.

Environment

Tested versions

libvt v0.0.1a4 and trunk 0864aa2, Linux ARM64 on WSL2, tmux 3.4, CPython 3.14.6.

Evidence

Observed output
native Z column 2 captured Z column 3 exact True

Proposal

Qualify cell-exactness for affected combinations of server version, captured text and Unicode width. Add a control with an ordinary two-cell glyph and compare the pane cursor and visible client.

  • Developer experience — Developers can identify when they need an attached-client screen to check layout.
  • Immediate benefit — Expose the known loss instead of silently approving a shifted glyph.
  • Longer-term benefit — Make per-version Unicode fidelity auditable independently of libvt’s own renderer.
  • End-user experience — A click or assertion on the text after the icon can use accurate coordinates or explicitly choose a live view.

References

Activity

  1. added
    bug
    p2
    on Nov 30, 2026
  2. tony commented on Dec 3, 2026

    @tony
    MemberAuthor

    In tmux 3.4, the native pane and the attached client both placed the neighbor of the VS16 glyph at column 2. Modern-width capture placed it at 3 and reported the uncertain column. In tmux 3.7 all three paths put the neighbor at 2. A CJK control agreed across both servers.

    The decoder can report the uncertainty for old servers. The selected server version comes from the parent capture fix. PR #174

  3. added a commit that references this issue on Dec 3, 2026
    424f0dc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugp2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions