requesting screen size in pixels (esc[14t) doesn't work immediately after node script start on mac when stdin is in raw mode and focus events are enabled #5639
-
hello, when i send the csi sequence and btw: thanks for ghostty! it's awesome! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
How would one check this? I'm assuming adding a program which checks to one's shell configuration, but I'm not sure. |
Beta Was this translation helpful? Give feedback.
-
i wrote a minimal test script. while doing it, i recognized that the terminal must be in // these two are prerequisites for the problem to occur:
process.stdin.setRawMode(true)
process.stdout.write('\x1b[?1004h') // enable focus events
process.stdout.write('\x1b[14t') // request screen size in pixels immediately, doesn't work in ghostty
// setTimeout((function () // workaround: doing it after a delay does work
// {
// process.stdout.write('\x1b[14t')
// }),10)
process.stdin.on('data',function (data)
{
var csi = data.slice(1).toString('utf8')
console.log('csi', csi) // this should print something like 'csi [4;2050;2222t'
if (data.length === 1 && (data[0] === 0x1b || data[0] === 0x03)) // exit on esc or ctrl+c
{
process.exit()
}
}) definitely a minor problem, but still would be nice to have consistent behaviour. |
Beta Was this translation helpful? Give feedback.
-
This is a known issue and is currently considered a "wontfix." I'm not sure the best way forward, but the reason this happens is because Ghostty initializes the pty concurrently to the GUI views, so initially we don't know our final size (an immediate resize happens usually). The easiest solution would be to not initialize the pty until the view is fully laid out, but this would slow down our startup times and I'm not sure how I feel about that. For now, registering for resize notifications and then requesting the size is the best option. |
Beta Was this translation helpful? Give feedback.
This is a known issue and is currently considered a "wontfix." I'm not sure the best way forward, but the reason this happens is because Ghostty initializes the pty concurrently to the GUI views, so initially we don't know our final size (an immediate resize happens usually).
The easiest solution would be to not initialize the pty until the view is fully laid out, but this would slow down our startup times and I'm not sure how I feel about that.
For now, registering for resize notifications and then requesting the size is the best option.