Skip to content

IIP Cursor Placement #57

Open
Open
@AnonymouX47

Description

Hello!

I recently realised the same cursor placement policies for sixels are used for IIP, by this implementation. This causes the behaviour for IIP to differ significantly (IMHO) from the reference implementation and every other implementation I'm aware of.

I'm aware cursor positioning is not specified in the document but I believe in such cases, the most sane choice is to comply with the reference implementation (particularly when the behaviour makes sense and is also followed by other implementations).

Deviations such as this cause application developers to introduce workarounds or special cases for such TEs, which isn't the best. See AnonymouX47/termvisage#9.

It'd be really good if cursor placement worked as expected i.e immediately to the right of the bottom-right-most cell touched by the image, without advancing the cursor to the next row when the images reaches the rightmost column of the screen (i.e just as the cursor behaves when text reaches the rightmost column of a row).

In addition, I think the doNotMoveCursor extension (implemented by Wezterm and Konsole, if I recall correctly) would be a worthy addition, if feasible. See wezterm/wezterm#1433 (by Autumn Lamonte, author of Jexer). The Wezterm docs states:

WezTerm supports an extension to the protocol; passing doNotMoveCursor=1 as an argument to the File escape sequence causes wezterm to not move the cursor position after processing the image.

Thank you. 🙏


For better context as to why I said "significantly" above:

In Wezterm:

simplescreenrecorder-2024-03-05_05.13.24.mp4

In xterm.js (via ttyd) (portions of (and in other cases, entire) images get overwritten by the TUI framework due to the misaligned cursor placements):

simplescreenrecorder-2024-03-05_05.08.47.mp4

For the record, this is the same application using unicode blocks to display images (to show that the issue is not an incompatibility between the framework and xterm.js):

simplescreenrecorder-2024-03-05_05.23.18.mp4

Side question:

Are you aware of any means for a program to detect that it's running within xterm.js (and maybe it's version)?

XTVERSION (CSI > q) doesn't seem to be implemented and I don't think env vars are viable as I don't think they can be set by xterm.js.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions