kovidgoyal / kitty

Cross-platform, fast, feature-rich, GPU based terminal
https://sw.kovidgoyal.net/kitty/
GNU General Public License v3.0
24.23k stars 976 forks source link

Random characters in kitty when starting #2983

Closed sunnyhasija closed 4 years ago

sunnyhasija commented 4 years ago

Describe the bug When I start kitty, I get either random letters already present atTthe prompt. Sometimes, when I try to use backspace to delete the letters, kitty crashes.

To Reproduce Steps to reproduce the behavior:

  1. startup kitty Expected behavior clean prompt when starting kitty

Screenshots Screenshot from 2020-09-27 10-00-50

Environment details OS: Pop! OS 20.04 Shell: fish

~ ❯❯❯ kitty --debug-config
kitty 0.15.0 created by Kovid Goyal
Linux sonnet 5.4.0-7642-generic #46~1598628707~20.04~040157c-Ubuntu SMP Fri Aug 28 18:02:16 UTC  x86_64
Pop!_OS 20.04 LTS \n \l
DISTRIB_ID=Pop
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Pop!_OS 20.04 LTS"
Loaded config files: /etc/xdg/kitty/kitty.conf
Running under: X11

Config options different from defaults:
update_check_interval 0.0
kovidgoyal commented 4 years ago

Your version of kitty is ancient. Uninstall it and install the official binaries from the kitty website.

sunnyhasija commented 4 years ago

Thank you for your prompt response. I uninstalled kitty (even though that is the version present in the ubuntu repositories), and installed the binaries from the website.

kitty 0.18.3 (4b0724530e) created by Kovid Goyal
Linux sonnet 5.4.0-7642-generic #46~1598628707~20.04~040157c-Ubuntu SMP Fri Aug 28 18:02:16 UTC  x86_64
Pop!_OS 20.04 LTS \n \l
DISTRIB_ID=Pop
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Pop!_OS 20.04 LTS"
Loaded config files: /etc/xdg/kitty/kitty.conf
Running under: X11

Config options different from defaults:
update_check_interval 0.0  

But I still have the same issue when I start a new shell.

Screenshot from 2020-09-27 10-26-11

kovidgoyal commented 4 years ago

Try bash or zsh.

sunnyhasija commented 4 years ago

nah, i'd rarther change emulators to Alacritty instead of changing my shell.

kovidgoyal commented 4 years ago

You dont need to change your shell. You actually need to run an up-to-date version of it. Which testing with bash or zsh would have confirmed. But whatever, good luck.

Luflosi commented 4 years ago

I think this was just meant as a help to try to debug your problem. kovidgoyal was not suggesting switching to a different shell. If this problem does happen with a different shell, then it's probably a problem with kitty.

sunnyhasija commented 4 years ago

@kovidgoyal sorry for misunderstanding your comment.

Changed shells to bash, and the problem does not occur. However, before you dismiss it as a fish issue, I tested Alacritty under fish as well, and it does not show the same behavior as kitty. There are no random characters.

Therefore the random characters are probably an artifact stemming from the interaction of fish and kitty

Luflosi commented 4 years ago

The next thing you could try is to rename the configuration file for fish, so that it can't be found by fish. If the problem does not happen without the configuration file, then it's something in that file and we can find out what it is later.

sunnyhasija commented 4 years ago

@Luflosi after testing seems like the problem is pywal that I am using as a wallpaper generator.

I used wal -R to make sure the color scheme is persistent when i start a new shell/reboot the computer. If I comment that out, I do not have the problem.

However, it does raise the question what exactly is causing the issue only in kitty and not in Alacritty.

Luflosi commented 4 years ago

According to https://github.com/dylanaraps/pywal/blob/4997a49eb7479ccda1228f064d6c50e1abedc5b4/pywal/reload.py#L80-L88, the -r argument is deprecated. Or is -r different from -R? Can you try to replace the deprecated argument with the suggested replacement? I doubt, this will fix it but you should try anyways.

sunnyhasija commented 4 years ago

wal -R is one of the flags as shown here https://github.com/dylanaraps/pywal/wiki/Getting-Started

it is distinct from wal -r

Luflosi commented 4 years ago

Ok, sorry for the confusion, I guess, I'll read the source some more.

Luflosi commented 4 years ago

Thanks for the link btw.

Luflosi commented 4 years ago

Can you send me the colors.json file from the cache directory of wal please? It's probably in ~/.cache/wal/colors.json.

sunnyhasija commented 4 years ago
    "wallpaper": "/home/cantos/Dropbox/Wallpapers/wallhaven-kwerxq.jpg",
    "alpha": "100",

    "special": {
        "background": "#02042B",
        "foreground": "#b5b1b9",
        "cursor": "#b5b1b9"
    },
    "colors": {
        "color0": "#02042B",
        "color1": "#473A51",
        "color2": "#5F535F",
        "color3": "#83623D",
        "color4": "#8C7368",
        "color5": "#A68D73",
        "color6": "#CAA977",
        "color7": "#b5b1b9",
        "color8": "#7e7b81",
        "color9": "#473A51",
        "color10": "#5F535F",
        "color11": "#83623D",
        "color12": "#8C7368",
        "color13": "#A68D73",
        "color14": "#CAA977",
        "color15": "#b5b1b9"
    } 

Here you go.

Luflosi commented 4 years ago

For some reason, wal uses both escape codes and the remote control feature of kitty to set the colors. Can you pass the -s parameter in addition to the -R parameter and see if your problem disappears and all the colors are still set correctly?

sunnyhasija commented 4 years ago

I passed -s and the problem still persists.

Moreover, wal does not bring back the set colors, but infact reverts to the default if i use the -s flag.

Luflosi commented 4 years ago

What happens if you pipe the result to /dev/null like so: pywal -R -s > /dev/null? Can you also enable remote control? See https://sw.kovidgoyal.net/kitty/remote-control.html.

sunnyhasija commented 4 years ago

I still have the issue when piping results to pywal -R -s > /dev/null . Moreover, the color settings are lost if I do that because of the -s flag.

Remote control is already enabled in kitty.conf

Luflosi commented 4 years ago

Are you sure it's enabled? The two outputs of kitty --debug-config don't show it being enabled. Your configuration file seems to be located at /etc/xdg/kitty/kitty.conf. You also need to restart kitty for the changes to take effect.

sunnyhasija commented 4 years ago

Here is the latest -debug-config.

kitty 0.18.3 (4b0724530e) created by Kovid Goyal
Linux sonnet 5.4.0-7642-generic #46~1598628707~20.04~040157c-Ubuntu SMP Fri Aug 28 18:02:16 UTC  x86_64
Pop!_OS 20.04 LTS \n \l
DISTRIB_ID=Pop
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Pop!_OS 20.04 LTS"
Loaded config files: /etc/xdg/kitty/kitty.conf, /home/cantos/.config/kitty/kitty.conf
Running under: X11

Config options different from defaults:
allow_remote_control  y
update_check_interval 0.0

But I still see the same error. Moreover, the -s flag removes the colors in the terminal anyways.

Luflosi commented 4 years ago

Try changing your shell in kitty.conf: shell python -c "import os;print(os.environ['HOME']); input()" This will print your home directory. Verify that it is correct.

sunnyhasija commented 4 years ago

yep. it shows "/home/cantos"

Luflosi commented 4 years ago

If I understand the code of pywal correctly, it should work. It does work correctly on my machine, in zsh and in fish. pywal first reads colors.json, generates all the different files in ~/.cache/wal/ from the values in colors.json, including colors-kitty.conf and then uses remote control to change the color scheme of kitty. I'm afraid, I can't help you. Open a bug in the pywal bug tracker and see if they know what's going on. Also link to this issue.

sunnyhasija commented 4 years ago

I'll do that.

Thank you for all your time and efforts @Luflosi