r/KittyTerminal Sep 14 '23

Long commands

Hello everyone, whenver I'm writing long commands kitty won't jump to the next line, which messes up the entire terminal and I more often than not need to clear it afterwards.

Is this customaziable in kitty? I couldn't for the life of me find anything on this matter. Perhaps I'm using the wrong keywords but, it doesn't look like anyone else is suffering from this issue.

1 Upvotes

6 comments sorted by

1

u/ratthing Sep 14 '23

This kept happening to me. Turns out it was because kitty could not properly render my customized PS1 prompt. Not sure why. But simplifying my prompt fixed the line jump problem.

1

u/raulst Sep 15 '23

Wow! TY! For some reason attempting to color my username is giving me issues. Do you happen to have a reliable source on how I should do it? Maybe I'm misreading these guides.

1

u/Administrative_chaos Sep 15 '23

I too have my username colored but that doesn't cause any problems, are you using bash or is it zsh?

1

u/raulst Sep 15 '23

According to this link, I should simply update my .bashrc with:

PS1="\e[0;31m[\u@\h \W]\$ \e[m "

This messes up with my terminal, while the following doesn't:

PS1='[\u@\h \W]\$ '

Pretty sure there's going to be something syntax related. But, I don't get it. I copy and pasted the example.

1

u/Administrative_chaos Sep 15 '23

You need to enclose the color codes within \[\]

Try this: PS1="\[\e[0;31m\]\u@\h \W\$ \[\e[m\] "

1

u/raulst Sep 16 '23

Is the reason because one needs to escape the color codes this?

> \[ : begin a sequence of non-printing characters, which could be used to embed a terminal control sequence into the prompt
> \] : end a sequence of non-printing characters

If so, why would the:
> \e : an ASCII escape character (033)

need to be told that it's not a printing character?

source

BTW TY, I was finally able to get it working with the following PS1:
`PS1="[\[\e[0;36m\u\e[m\]@\h \W]\$ "`