Skip to content

Model tmux phantom column, IL/DL column, and tmux_version #10

Closed

Description

@tony

Summary

TMUX_PROFILE in src/libvt/config.py and src/libvt/terminal.py (#2) models tmux's right-margin phantom column (s->cx == sx) on CUB and BS only, diverging from live tmux 3.8a across 12 other right-margin operations (EL 0 wiping column 79 on top reverse-video headers, ED 0, ECH, ICH, DCH, CBT, LF/IND/RI/VPA, DECRC, and CSI 6 n), mid-line IL/DL horizontal cursor retention, capture-pane -e bare SO/SI G1 DEC Special Graphics, and post-3.8 wide-cell ICH (b03b71f) and REP (8b95395) changes.

Reproduction

  1. Feed a full-width reverse-video header followed by SGR 0 and EL 0 (CSI K), plus CSI 6 n and mid-line IL (CSI L), under TMUX_PROFILE:
$ uv run python -c 'from libvt import TMUX_PROFILE, Terminal; vt = Terminal(rows=4, cols=20, profile=TMUX_PROFILE); vt.feed(b"\x1b[7mABCDEFGHIJKLMNOPQRST\x1b[m\x1b[K\x1b[6n"); print("row0:", repr(vt.screen[0].text), "cpr:", vt.drain_replies()); vt2 = Terminal(rows=4, cols=20, profile=TMUX_PROFILE); vt2.feed(b"abcdef\x1b[1;4H\x1b[Lx"); print("il:", vt2.lines)'

Expected

Against tmux 3.8a (tmux -f /dev/null):

  • row0 keeps all 20 characters 'ABCDEFGHIJKLMNOPQRST' (EL 0, ED 0, ECH, ICH, and DCH are no-ops when s->cx > sx - 1 in screen-write.c).
  • cpr (CSI 6 n) replies b'\x1b[1;21R' (cols + 1, from s->cx + 1 in input.c).
  • LF, IND, RI, and VPA at phantom column preserve cx == cols so a following printable character wraps onto the row below; DECRC clamps cx to cols - 1; CBT steps back from cols to the prior tab stop.
  • il (IL / DL mid-line) preserves cx ((' x', 'abcdef')) instead of resetting cx to left.
  • capture-pane -e streams containing bare SO (0x0e) render DEC Special Graphics box-drawing (default_g1_charset = "0" on TMUX_PROFILE).
  • Profile.tmux_version distinguishes tmux <= 3.8 (REP no-op at cx == cols; unblanked ICH/DCH/ECH on wide-glyph right half) from post-3.8 upstream tmux (b03b71f screen_write_clear_padding and 8b95395 REP wrap).

Actual

row0: 'ABCDEFGHIJKLMNOPQRS ' (column 19 erased), cpr: b'\x1b[1;20R', and il: ('x', 'abcdef').

Environment
  • libvt: #2 (feat/v2-architecture, 0.1.0a0)
  • Python: 3.15.0 (unicodedata 17.0.0)
  • Reference tmux: 3.8a (tmux -f /dev/null)
  • OS: Linux x86_64

Proposal

Invariants

The invariants below are load-bearing; everything under Intent is open.

  • DEFAULT_PROFILE and XTERM_PROFILE preserve standard DEC/xterm right-margin pending_wrap semantics (EL 0 erases cols - 1, IL/DL reset column to left, CSI 6 n clamps to cols, G1 defaults to 'B').
  • TMUX_PROFILE reproduces inner tmux pane emulation for its declared tmux_version, and documentation distinguishes inner-pane TMUX_PROFILE from outer-client DEFAULT_PROFILE / XTERM_PROFILE (used when feeding attached tmux client output including display-popup overlays and borders).

Intent (non-binding)

  • Provide a Profile.tmux(version=...) factory configuring orthogonal positive behavioral fields on Profile (il_dl_resets_col: bool = True, rep_wraps: bool = True, default_g1_charset: Charset = "B") alongside pending_wrap_phantom_col rather than coupling Terminal branches to raw version tuples.
  • Guard EL 0, ED 0, ECH, ICH, DCH, CBT, LF/IND/RI/VPA, DECRC, CSI 6 n, and IL/DL cursor-column handling on Profile while keeping _Row cell indices strictly in 0..cols - 1.

Not doing

  • Porting tmux's GRID_FLAG_TAB horizontal grid_reflow implementation.

References

Activity

  1. added
    bug
    on Nov 22, 2026
  2. tony commented on Nov 23, 2026

    @tony
    MemberAuthor

    Resolved in #2 (0c7ee41).

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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions