Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DRAFT] Implement the XTWINOPS (CSI t) control sequences that "make sense". #2057

Merged
merged 4 commits into from
Aug 10, 2024

Conversation

jcollie
Copy link
Collaborator

@jcollie jcollie commented Aug 7, 2024

I marked this as "draft" because changes were made on the macOS/embedded side of things and I have no way to really test those changes so I'm sure something there is bungled.

See XTWINOPS for specs on these sequences.

Fixes #2046.

These sequences were implemented:

CSI 14 t - report the text area size in pixels
CSI 16 t - report the cell size in pixels
CSI 18 t - report the text area size in cells
CSI 21 t - report the window title

These sequences were not implemented because they manuipulate the window state in ways that we do not want.

CSI 1 t
CSI 2 t
CSI 3 ; x ; y t
CSI 4 ; height ; width ; t
CSI 5 t
CSI 6 t
CSI 7 t
CSI 8 ; height ; width ; t
CSI 9 ; 0 t
CSI 9 ; 1 t
CSI 9 ; 2 t
CSI 9 ; 3 t
CSI 10 ; 0 t
CSI 10 ; 1 t
CSI 10 ; 2 t
CSI 24 t

These sequences were not implemented because they do not make sense in a Wayland context:

CSI 11 t
CSI 13 t
CSI 14 ; 2 t

These sequences were not implemented because they provide information about the screen that is unnecessary.

CSI 15 t
CSI 19 t

These sequences were not implemeted because Ghostty does not maintain an icon title for windows.

CSI 20 t
CSI 22 ; 0 t
CSI 22 ; 1 t
CSI 23 ; 0 t
CSI 23 ; 1 t

These sequences were not implemented because of the additional complexity of maintaining a stack of window titles.

CSI 22 ; 2 t
CSI 23 ; 2 t

jcollie and others added 3 commits August 7, 2024 00:12
These sequences were implemented:

CSI 14 t - report the text area size in pixels
CSI 16 t - report the cell size in pixels
CSI 18 t - report the text area size in cells
CSI 21 t - report the window title

These sequences were not implemented because they manuipulate the window
state in ways that we do not want.

CSI 1 t
CSI 2 t
CSI 3 ; x ; y t
CSI 4 ; height ; width ; t
CSI 5 t
CSI 6 t
CSI 7 t
CSI 8 ; height ; width ; t
CSI 9 ; 0 t
CSI 9 ; 1 t
CSI 9 ; 2 t
CSI 9 ; 3 t
CSI 10 ; 0 t
CSI 10 ; 1 t
CSI 10 ; 2 t
CSI 24 t

These sequences were not implemented because they do not make sense in
a Wayland context:

CSI 11 t
CSI 13 t
CSI 14 ; 2 t

These sequences were not implemented because they provide information
about the screen that is unnecessary.

CSI 15 t
CSI 19 t

These sequences were not implemeted because Ghostty does not maintain an
icon title for windows.

CSI 20 t
CSI 22 ; 0 t
CSI 22 ; 1 t
CSI 23 ; 0 t
CSI 23 ; 1 t

These sequences were not implemented because of the additional
complexity of maintaining a stack of window titles.

CSI 22 ; 2 t
CSI 23 ; 2 t
@@ -3,7 +3,7 @@ const builtin = @import("builtin");
pub usingnamespace @import("sanitize.zig");

const charsets = @import("charsets.zig");
const stream = @import("stream.zig");
pub const stream = @import("stream.zig");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sus. We should export whatever it is you needed in here.

@@ -24,6 +24,13 @@ const log = std.log.scoped(.stream);
/// do something else.
const debug = false;

pub const ReportStyle = enum {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file probably isn't the right place for this. It should probably be in csi.zig or something.

@mitchellh
Copy link
Contributor

I addressed my own minor feedback. Everything else looks very good. Thank you!

@mitchellh
Copy link
Contributor

I'll fix up the macOS builds!

@mitchellh
Copy link
Contributor

I changed it so that the embedded apprt just stores the title itself... this was much simpler for memory lifecycle management.

@mitchellh mitchellh merged commit edea928 into ghostty-org:main Aug 10, 2024
17 of 19 checks passed
@mitchellh mitchellh deleted the xtwinops branch August 10, 2024 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement CSI t to query terminal dimensions in pixels
2 participants