edit icon indicating copy to clipboard operation
edit copied to clipboard

Edit won't launch with ghostty

Open minegameYTB opened this issue 1 year ago • 10 comments

I've just tried edit on linux (especially NixOS) and I've just noticed that it doesn't work with ghostty (it works correctly with gnome-console (gnome) and konsole (kde)).

if needed, here's the info on the operating system (and on dynamic libraries)

configuration : https://github.com/minegameYTB/nixos-configuration

nix-info :
- system: `"x86_64-linux"`
 - host os: `Linux 6.12.28, NixOS, 24.11 (Vicuna), 24.11.20250517.9b5ac7a`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.24.14`
 - nixpkgs: `/nix/store/qlx1ax4mbysg1alcd0gc3njgm59d76my-source`

ldd edit-1.0.0-x86_64-linux-gnu (with nix-ld for compatibility):

linux-vdso.so.1 (0x00007f3ca9563000)
        libm.so.6 => /nix/store/p9kdj55g5l39nbrxpjyz5wc1m0s7rzsx-glibc-2.40-66/lib/libm.so.6 (0x00007f3ca9442000)
        libc.so.6 => /nix/store/p9kdj55g5l39nbrxpjyz5wc1m0s7rzsx-glibc-2.40-66/lib/libc.so.6 (0x00007f3ca924a000)
        /lib64/ld-linux-x86-64.so.2 => /nix/store/p9kdj55g5l39nbrxpjyz5wc1m0s7rzsx-glibc-2.40-66/lib64/ld-linux-x86-64.so.2 (0x00007f3ca9565000)

edit: even when compiling manually “edit”: I have the same problem with ghostty

minegameYTB avatar May 20 '25 14:05 minegameYTB

This is an upstream issue with ghostty not handling OSC 4 with multiple palette entries requested at once, https://github.com/ghostty-org/ghostty/issues/7402

qwerasd205 avatar May 20 '25 15:05 qwerasd205

We should keep this open, because ideally the editor should specify a timeout while waiting for a response.

lhecker avatar May 20 '25 17:05 lhecker

It seems like the code in the query (in edit) should be handling this, it's even commented https://github.com/microsoft/edit/blob/d74c330f2b74134a7fd5f97f78933472049129d3/src/bin/edit/main.rs#L509-L512 so I suspect that there's an additional bug in Ghostty, perhaps causing it not to recognize the CSI c request after failing to handle the OSC. (It is probably a good idea to use a timeout regardless though.)

qwerasd205 avatar May 20 '25 18:05 qwerasd205

I've just tried edit on linux (especially NixOS) and I've just noticed that it doesn't work with ghostty (it works correctly with gnome-console (gnome) and konsole (kde)).

if needed, here's the info on the operating system (and on dynamic libraries)

configuration : https://github.com/minegameYTB/nixos-configuration

nix-info :
- system: `"x86_64-linux"`
 - host os: `Linux 6.12.28, NixOS, 24.11 (Vicuna), 24.11.20250517.9b5ac7a`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.24.14`
 - nixpkgs: `/nix/store/qlx1ax4mbysg1alcd0gc3njgm59d76my-source`

ldd edit-1.0.0-x86_64-linux-gnu (with nix-ld for compatibility):

linux-vdso.so.1 (0x00007f3ca9563000)
        libm.so.6 => /nix/store/p9kdj55g5l39nbrxpjyz5wc1m0s7rzsx-glibc-2.40-66/lib/libm.so.6 (0x00007f3ca9442000)
        libc.so.6 => /nix/store/p9kdj55g5l39nbrxpjyz5wc1m0s7rzsx-glibc-2.40-66/lib/libc.so.6 (0x00007f3ca924a000)
        /lib64/ld-linux-x86-64.so.2 => /nix/store/p9kdj55g5l39nbrxpjyz5wc1m0s7rzsx-glibc-2.40-66/lib64/ld-linux-x86-64.so.2 (0x00007f3ca9565000)

edit: even when compiling manually “edit”: I have the same problem with ghostty

Can you please change the title to Linux & Mac

As it is broken on Ghostty on the Mac as well 😄

stormasm avatar May 21 '25 03:05 stormasm

@minegameYTB should I go ahead and create a separate issue for Ghostty on the Mac ? Or will this one suffice...

stormasm avatar May 21 '25 03:05 stormasm

ghostty's VT handling is the same on any platform, so one issue is sufficient. 🙂

lhecker avatar May 21 '25 12:05 lhecker

There is a draft PR here that fixes edit running on Ghostty: https://github.com/ghostty-org/ghostty/pull/7429

jcollie avatar May 24 '25 03:05 jcollie

The PR that fixes this has been merged.

jcollie avatar May 30 '25 20:05 jcollie

It's quite the large PR. Sorry you had to go through that! I'll close this issue then. I hope the fix can be released soon. 🙂

lhecker avatar May 30 '25 20:05 lhecker

It's a large PR mostly because I changed approaches to solving this in several times. The final diff isn't too large if everything was squashed down. Ghostty's better off for it in the long run!

jcollie avatar May 30 '25 20:05 jcollie