You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In bash, I call a function to set a dynamic prompt like this: export PS1='$(some_func)' (Must be single quotes or it will eval the command substitution before setting the envar and thus will not be dynamic). This method works fine in every terminal emulator I've tried (including kitty with shell_integration disabled).
This also mostly works fine in kitty when shell_integration is enabled, unless the function call is used to set a multiline prompt. In this case, resizing the window causes part of the prompt to disappear.
Here is a minimal way to reproduce this which demonstrate the difference in behaviour between shell_integration enabled/disabled:
Working as expected
Start both kitty and bash without any config, aside from explicitly disabling kitty shell integration:
This shell now has a dynamic multiline prompt (which you can see by changing directories).
Because shell_integration is disabled. Resizing the window does not cause any issues.
Prompt disappears
Again, start both kitty and bash without any config. But this time we are explicitly enabling kitty shell integration:
The reason is that bash does not redraw the first line of a multiline
prompt on resize. And kitty will delete it with shell integration. See
lines 163 onwards in kitty.bash for details.
Of course using double quotes means pwd is not updated, so what you
actually need is something like
export PS1='┌─[$(pwd)\n└──╼ ';
basically the newline needs ot be a static part of PS1 not a dynamically
output one.
Or just use a better shell like zsh/fish that doesnt have this
limitation.
In bash, I call a function to set a dynamic prompt like this:
export PS1='$(some_func)'
(Must be single quotes or it will eval the command substitution before setting the envar and thus will not be dynamic). This method works fine in every terminal emulator I've tried (including kitty with shell_integration disabled).This also mostly works fine in kitty when shell_integration is enabled, unless the function call is used to set a multiline prompt. In this case, resizing the window causes part of the prompt to disappear.
Here is a minimal way to reproduce this which demonstrate the difference in behaviour between shell_integration enabled/disabled:
Working as expected
Start both kitty and bash without any config, aside from explicitly disabling kitty shell integration:
Then in that terminal create a function which returns a simple multiline prompt, and set the
PS1
to call it:This shell now has a dynamic multiline prompt (which you can see by changing directories).
Because shell_integration is disabled. Resizing the window does not cause any issues.
Prompt disappears
Again, start both kitty and bash without any config. But this time we are explicitly enabling kitty shell integration:
Then, exactly as before, in that terminal create a function which returns a simple multiline prompt, and set the
PS1
to call it:Again we now have a dynamic multiline prompt. But this time if we even slightly resize the window, the first line of the prompt disappears.
Before Resize:
![image](https://private-user-images.githubusercontent.com/2265764/313175977-2a03d73b-43f5-4389-a528-58d469acb41a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk2MzQxMzAsIm5iZiI6MTcxOTYzMzgzMCwicGF0aCI6Ii8yMjY1NzY0LzMxMzE3NTk3Ny0yYTAzZDczYi00M2Y1LTQzODktYTUyOC01OGQ0NjlhY2I0MWEucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDYyOSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA2MjlUMDQwMzUwWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZDQ4ZTBlOGQ1OTIzNjcyMWYwNDk2NGI1NTY3YjMxZDkwMmZhZWI2YzBmYWFlNWZhNGE3YjAxMGQ4ZmIzODllNSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.TC4H8mhAqJxXcsd_tKG91XZ4cUjumft6SxG_nn8l1us)
After Resize:
![image](https://private-user-images.githubusercontent.com/2265764/313176058-09b11fdd-6c1b-4695-89a7-7fdaad280b51.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk2MzQxMzAsIm5iZiI6MTcxOTYzMzgzMCwicGF0aCI6Ii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ZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NWQzZjEyMThlYjUxYzJhZGJlYTZiZGI4NDU1MTBiZDEzOGZkN2IzNzk5NGNkYjU0ZTg5MTBmNjY1ZTUyZmQ5OSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.BgFpvQZD3w3l4WFX4tLUTquwL9hr8JVLVSjPzt3bwSk)
System Info
The text was updated successfully, but these errors were encountered: