Closed 10b14224cc closed 4 months ago
Is the problem that you face only reproducible with Starship? I first tried it without Starship, i.e., just with kitty and plain Bash plus ble.sh, but there is already a problem, though I'm not sure if that is the identical problem as yours. Anyway, I'll fix the problem that I found in my environment.
You are right. starship is unrelated to the issue and the issue happens also without starship.
Typing:
echo "hello"
echo "hi"
Pressing kitty_mod+g
:
Without ble.sh:
With ble.sh:
I will modify the issue.
issue still present with latest git.
I took a look at this issue.
First of all, kitty's shell integration does something non-trivial. kitty disables the loading of ~/.bashrc
and lets Bash instead load kitty's initialization script. Then, the user's ~/.bashrc
is sourced from the kitty's initialization script. After loading ~/.bashrc
, kitty's shell integration continues to set its PROMPT_COMMAND
. However, as described in ble.sh's README, ble-attach
needs to be executed at the end of ~/.bashrc, or more precisely ble-attach needs to be executed at the end of the shell initialization script. Any changes to PROMPT_COMMAND
after ble-attach
inside the initialization process will be discarded, which is to avoid the double execution of PROMPT_COMMAND
by blesh and readline. So the PROMPT_COMMAND
setting added by kitty after sourcing ~/.bashrc
is discarded.
In this case, you need to give up the ble-attach
approach (as kitty will never give up this approach). Then, the only way is to use the default approach (which is used when you just source ble.sh
without passing --attach=none
and don't call ble-attach
). However, this is blocked by a bug in kitty's shell integration. I'll submit a PR. It is a trivial one, so I expect it's not so difficult to convince Kovid.
I took a look at this issue.
First of all, kitty's shell integration does something non-trivial. kitty disables the loading of
~/.bashrc
and lets Bash instead load kitty's initialization script. Then, the user's~/.bashrc
is sourced from the kitty's initialization script. After loading~/.bashrc
, kitty's shell integration continues to set itsPROMPT_COMMAND
. However, as described in ble.sh's README,ble-attach
needs to be executed at the end of ~/.bashrc, or more precisely ble-attach needs to be executed at the end of the shell initialization script. Any changes toPROMPT_COMMAND
afterble-attach
inside the initialization process will be discarded, which is to avoid the double execution ofPROMPT_COMMAND
by blesh and readline. So thePROMPT_COMMAND
setting added by kitty after sourcing~/.bashrc
is discarded.In this case, you need to give up the
ble-attach
approach (as kitty will never give up this approach). Then, the only way is to use the default approach (which is used when you just sourceble.sh
without passing--attach=none
and don't callble-attach
). However, this is blocked by a bug in kitty's shell integration. I'll submit a PR. It is a trivial one, so I expect it's not so difficult to convince Kovid.
Wow, that is turning out much more complicated than expected.
Thanks for the hard work!
It's merged in kitty. It will be applied to the next release of kitty. After updating kitty to a fixed version, you can set up ble.sh using the auto-attach instead of using the manual attach (--attach=none
and ble-attach
).
# around the top of ~/.bashrc
[[ $- == *i* ]] && source /path/to/ble.sh
There's no fix on ble.sh's side.
It's merged in kitty. It will be applied to the next release of kitty. After updating kitty to a fixed version, you can set up ble.sh using the auto-attach instead of using the manual attach (
--attach=none
andble-attach
).# around the top of ~/.bashrc [[ $- == *i* ]] && source /path/to/ble.sh
There's no fix on ble.sh's side.
So the suggestion to ALWAYS use the two part initialization scheme (one row at the top, one at the bottom) doesn't hold for kitty?
Where is that suggestion? I have never written "always". Did anyone suggest you to use it always?
edit To answer the question, no, it doesn't hold for kitty.
kitty version 0.32.2 seems to have been released two days ago. @10b14224cc Could you confirm that the issue is fixed?
kitty version 0.32.2 seems to have been released two days ago. @10b14224cc Could you confirm that the issue is fixed?
Yes I don't see the prompt anymore. Thanks.
Thanks!
ble version:
Using ble.sh,
kitty @ get-text --extent=last_cmd_output
returns the last prompt together with the last command output.See also: https://github.com/mikesmithgh/kitty-scrollback.nvim/issues/179#issuecomment-1924045919 See also: https://github.com/kovidgoyal/kitty/issues/7099
To reproduce:
kitty_mod+g
hi
(output of last command) together with last prompthi
without the last prompt.