On 2025-12-05 15:59, Thomas Wolff via Cygwin wrote:
Am 05.12.2025 um 21:05 schrieb Brian Inglis via Cygwin:
On 2025-12-05 02:52, Takashi Yano via Cygwin wrote:
On Thu, 4 Dec 2025 12:01:58 +0100, Corinna Vinschen wrote:
On Dec  3 17:56, Takashi Yano via Cygwin wrote:
Subject: [PATCH v2] Cygwin: pty: Experimental OpenConsole.exe support
Some commit message here?  Yeah, I know, it's just experimental for now :)

Signed-off-by: Takashi Yano <[email protected]>
+  size_t towrite = len;
+
    ssize_t ret;
    char *p = (char *) ptr;
    termios &ti = tc ()->ti;
@@ -2152,7 +2284,7 @@ fhandler_pty_master::write (const void *ptr, size_t len)
       If the reply for "CSI6n" is divided into multiple writes,
       pseudo console sometimes does not recognize it. Therefore,
       put them together into wpbuf and write all at once. */
-      static const int wpbuf_len = strlen ("\033[32768;32868R");
+      static const int wpbuf_len = 64; /* for response to CSI6n nad CSIc */

Is there some macro for the count of 64 in this context, by any chance?

I'm not sure for now that 64 is really enough for the responce to ESC[c.
mintty returns about 30 byte responce. But some other terminal may return
longer responce.

https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h4-Functions-using- CSI-_-ordered-by-the-final-character-lparen-s-rparen:CSI-Ps-c.1CA3

Responses include \e [ ? # # c 6 for base ctl seq plus term type e.g. 64 from mintty; plus ";" separated attributes up to 7 (round to 8) each single digit and 8 double digit => 6 + 16 + 24 <= 46
e.g. for mintty \e[?64;1;2;4;6;9;11;15;21;22;28;29c => 6 + 10 + 18 = 34

This calculation is obscure to me. Each number after the "64" base indication (meaning VT420 compability level) indicates a certain feature as listed in DEC docs. Well, descriptions of some of them are also obscure.

The calculation is just the maximum documented parameters and lengths, plus parameter delimeter lengths, plus report esc seq length; and that reported by mintty; from a shell function I use that decodes reports to term type and single character feature codes, emulator/emulation and version, coordinate type and units, and displays reports with cat -A; for example:

$ xterm-info
type features   VT420wpSeNThcrl ^[[c            ^[[?\wraps
64;1;2;4;6;9;11;15;21;22;28;29c$
type version    mintty v3.8.1-0 ^[[>c                ^[[>77;30801;0c$
window position 3 px 210+120    ^[[13t          ^[[3;210;120t$
window size     4 px 875x881    ^[[14;2t        ^[[4;881;875t$
text position   3 px 219+152    ^[[13;2t        ^[[3;219;152t$
text size       4 px 840x840    ^[[14t          ^[[4;840;840t$
text chars      8 ch 120x60     ^[[18t          ^[[8;60;120t$
char size       6 px 7x14       ^[[16t          ^[[6;14;7t$
screen chars    9 ch 274x77     ^[[19t          ^[[9;77;274t$
screen size     5 px 1920x1080  ^[[15t          ^[[5;1080;1920t$
window status   1 open          ^[[11t          ^[[1t$

LXterminal:

$ xterm-info
type features   VT220N          ^[[c            ^[[?62;9;c$
type version    VT220 v28.2-0   ^[[>c                ^[[>1;2802;0c$
window position 3 px 135+158    ^[[13t          ^[[3;135;158t$
window size     4 px 840x900    ^[[14;2t        ^[[4;900;840t$
text position   3 px 135+158    ^[[13;2t        ^[[3;135;158t$
text size       4 px 840x900    ^[[14t          ^[[4;900;840t$
text chars      8 ch 120x60     ^[[18t          ^[[8;60;120t$
char size       6 px 7x15       ^[[16t          ^[[6;15;7t$
screen chars    9 ch 274x72     ^[[19t          ^[[9;72;274t$
screen size     5 px 1920x1080  ^[[15t          ^[[5;1080;1920t$
window status   1 open          ^[[11t          ^[[1t$

None of the features are obscure when you read the User Guide or Programmer Reference and tried to exploit any useful features of early glass ttys pre- and post-ANSI, on your systems and in your work.

Could default to column width if longer to allow room for prompts and titles; max parameter value lengths are 5 digits; text strings may be longer; querying 8/16/88/256 colour palettes or similar could require more space.
Escape sequences are not related to column width. \e[ are "CSI" escape sequences and their parameter must be numbers only (by ECMA-48 «Control Functions for Coded Character Sets»).

But DCS, OSC, PM, and regular escape sequences may take or report string parameters terminated by ST, by default in ISO-8859-1, but some modes support UTF-8 encoding, hex encoding, and some other character codes, so space allocated might need to be expanded based on screen columns and encodings used, just as space allocated for cursor position reports is based on max parameter values.

--
Take care. Thanks, Brian Inglis              Calgary, Alberta, Canada

La perfection est atteinte                   Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter  not when there is no more to add
mais lorsqu'il n'y a plus rien à retrancher  but when there is no more to cut
                                -- Antoine de Saint-Exupéry

--
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

Reply via email to