Closed teutat3s closed 2 months ago
Thanks. The problem doesn't seem to arise in my environment.
$ ble/widget/display-shell-version
$ INPUTRC=/dev/null bash --norc --noprofile
$ source out/ble.sh --norc --noinputrc
$ eval "$(starship init bash)"
$ # <-- check if the problem reproduces
Thank you for the debugging help!
❯ ble/widget/display-shell-version
GNU bash, version 5.2.15(1)-release (x86_64-pc-linux-gnu) [NixOS 23.11 (Tapir)]
ble.sh, version 0.4.0-devel4+27e6309 (noarch) [git 2.42.0, GNU Make 4.4.1, GNU Awk 5.2.2, API 3.2, PMA Avon 8-g1]
bash-completion, version 2.11 (hash:deb4862e60d728757fcb1067b689fd4d35c3fbe4, 76396 bytes) (noarch)
fzf key-bindings, (hash:18db7a864d576755199efdfee73ff29345833da7, 5577 bytes) (noarch)
WARNING: fzf integration "integration/fzf-key-bindings" is not activated.
starship, version 1.17.1 (rustc 1.73.0 (cc66ad468 2023-10-03) (built from a source tarball), 1980-01-01 00:00:00 +00:00)
locale: LANG=en_US.UTF-8
terminal: TERM=xterm-256color wcwidth=15.0-west/15.1-2+ri, alacritty:1901 (0;1901;1)
I was not able to reproduce the problem with only plain ble.sh
plus starship
, following your commands. That hints at something in my config that inserts those newlines. Do you have any idea where to look?
I have to add, I cannot reproduce the problem with plain bash
+ starship
. When running the commands you mentioned, I get this when trying to source ble.sh
:
❯ INPUTRC=/dev/null bash --norc --noprofile
bash-5.2$ echo $(blesh-share)/ble.sh
/nix/store/5cjglj17b6a1jgy45brmv6p92ah175dm-blesh-27e6309ef2344d37a6cec49f37b958c70f660472/share/blesh/ble.sh
bash-5.2$ source $(blesh-share)/ble.sh --norc --noinputrc
ble.sh: ble.sh is not intended to be used with the line-editing mode disabled (--noediting).
bash-5.2$ eval "$(starship init bash)"
I was not able to reproduce the problem with only plain
ble.sh
plusstarship
,
I'm confused. Let me confirm. Does that mean Bash works with the plain ble.sh
plus starship without problems? Or does it mean just you couldn't test it because ble.sh is not loaded? In the next reply, you've posted another result, but is it the same as the one you first tried? Or do you try that in a separate environment, which produced a different result?
bash-5.2$ source $(blesh-share)/ble.sh --norc --noinputrc ble.sh: ble.sh is not intended to be used with the line-editing mode disabled (--noediting).
nix-shell
, nix shell
, or nix develop
? The bash
binary provided in those environments is a dumb binary that is not intended for interactive use so is not suited for testing the behavior.$ type -a bash
$ ls -la "/proc/$$/exe"
Sorry for the confusion. I first though the message from ble.sh
was just a warning, but then noticed it was an error and it did not start. That's why I couldn't test it yet, because ble.sh
was not loaded.
Q4: Thank you for the pointer, it looks like I accidentally DID run this inside a nix shell
without noticing.
Q4a: The answer to Q4 is yes :innocent:
Q3: We're back to my initial response. I was not able to reproduce the problem with only plain ble.sh plus starship, following your commands. That hints at something in my config that inserts those newlines. Do you have any idea where to look?
EDIT: To give you some additional context, this is my bash
/ ble.sh
config.
EDIT2: By commenting out parts of initExtra
, I have tracked it down to some ble.sh
option in lines 43 - 90. But I have no idea yet which one it might be.
EDIT3: Further tracked down to lines 74 - 90, where I configure vim mode for ble.sh
. :mag: :detective:
Okay, I found out that somehow enabling vim mode in ble.sh
triggers the newlines being inserted at the top in my environment.
if [[ $- == *i* ]]; then # in interactive session
set -o vi
fi
Without these lines in my config, all is well. How would I continue to debug this?
Another hint, I tried out the change mentioned in this comment to see if anything changes and IT DOES fix the newlines being inserted for me.
Maybe do you set add_newline = true
in your starship configuration? If that Starship setting outputs something in evaluating PROMPT_COMMAND
, it might cause the shift of the cursor position in the terminal display when there is a vi-mode indicator. If you would like to achieve the behavior add_newline
with ble.sh, could you set add_newline = false
in the starship configuration and instead use ble.sh
's bleopt prompt_ruler=empty-line
?
Or it causes a small delay, but you might set bleopt prompt_command_changes_layout=1
.
I have that starship option set to false.
Thank you. Hmm, then my guess was not correct.
Could you check if the situation changes when you set bleopt prompt_command_changes_layout=1
?
I have tried with bleopt prompt_command_changes_layout=1
just now and the problem is still there.
Sorry for the delay. Currently, I don't have an idea. I'll take a look at your settings again later.
@teutat3s After some investigations, this finally turned out to be a bug of Alacritty in v0.7.0..0.13.1 (https://github.com/alacritty/alacritty/pull/7725). It is fixed in the latest version of Alacritty. Which version of Alacritty do you use? Could you update Alacritty to the latest version (v0.13.2)?
Nice bug hunting, thanks! I can confirm updating to the latest alacritty version fixes the issue here. :raised_hands: :tada:
Thank you!
ble version:
0.4.0-devel4+27e6309
Bash version:5.2.15(1)-release (x86_64-pc-linux-gnu)
When scrolling up in bash with
ble.sh
installed, and with previous output above, I can observe two newlines being inserted at the top of the terminal. I am looking for debugging guidance to better understand why this happens - and to find out if this is a problem inble.sh
or something else causing this. If desired, I can try to record a short video to show the problem in action.What I have tried:
Other installed components:
starship