Skip to content

Keep pending wrap through a tab at the right edge #101

In review

Description

@tony

Summary

A tab received at the final occupied column cancels pending wrap under the Ghostty profile. The next character overwrites the last character on the line.

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.

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

from libvt import Terminal
from libvt.profiles import GHOSTTY_PROFILE

for tail in (b"X", b"\tX"):
    terminal = Terminal(rows=2, cols=5, profile=GHOSTTY_PROFILE)
    terminal.feed(b"12345" + tail)
    print(repr(tail), terminal.committed.lines)
    assert terminal.committed.lines == ("12345", "X"), "the tab changed where the next byte printed"
  1. Run the case.
$ uv run --no-sync python case.py

Expected

Keep the pending wrap when the tab has nowhere to move. Both Ghostty 1.0.2 and a real xterm 390 wrap the following character in the measured case.

Actual

The no-tab control wraps X. With the tab inserted, the original last character becomes X.

Environment

Tested versions

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

Evidence

Observed output
b'X' ('12345', 'X')
b'\tX' ('1234X', '')
Independent application or native control
right edge with tab libvt ('1234X', '') Ghostty ('12345', 'X')

Proposal

Preserve pending wrap on a right-edge horizontal tab for the host profiles with this behavior. Retain independent cases for a genuine move to the next tab stop.

  • Developer experience — Terminal-layout tests can exercise narrow, edge-aligned columns without special-casing tabs.
  • Immediate benefit — Add a byte-for-byte comparison that types a character after the tab.
  • Longer-term benefit — Host conformance coverage will include deferred wrap transitions and their subsequent visible effects.
  • End-user experience — A tab-separated status row retains its last character when it exactly fills the viewport.

References

Activity

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

    @tony
    MemberAuthor

    At the right edge, a forward tab now keeps deferred wrap until the next printable. In the 2×5 123界 fixture, HT followed by X leaves the first row intact and puts X at row 1, column 0. The native checks include Ghostty VT 1.0.2 and XTerm 390. PR #184

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