ble.sh icon indicating copy to clipboard operation
ble.sh copied to clipboard

[starship, alacritty] Additional carriage return added above the prompt

Open returntrip opened this issue 3 years ago • 5 comments

GNU bash, version 5.1.8(1)-release (x86_64-redhat-linux-gnu) ble.sh, version 0.4.0-devel3+c513ed4 (noarch)

Another strange Starship (and this time Alacritty) interaction issue. This time on a different machine with dual screen.

On my secondary screen, and only when i have two Alacritty terminals side by side, as I move between the primary and secondary screen, a carriage return is added above the prompt (on both terminal windows).

I will attach a video to show what happens. https://nextcloud.figura.io/s/FBaLgWPQaJeBAcA

I am not expecting a fix, cause my setup is non standard, but I wanted to report this anyway.

returntrip avatar Feb 17 '22 07:02 returntrip

Thank you for the report. Hmm, interesting behavior. I have questions.

  • Q1: Is the behavior reproduced with the following setting?
bleopt canvas_winch_action=redraw-prev
  • Q2: What would be output after the following steps?
  1. First run ble/debug/keylog#start
  2. Move between the primary and secondary screens (to reproduce the behavior)
  3. Finally run ble/debug/keylog#end. This will output to the terminal the information of the bytes that ble.sh received between ble/debug/keylog#start and ble/debug/keylog#end, along with the decoded results.

P.S.

  • Q3: With the following setting, does the cursor position go to the top of the screen on moving between the primary and secondary displays?
bleopt canvas_winch_action=clear

akinomyoga avatar Feb 17 '22 07:02 akinomyoga

Thank you for the report. Hmm, interesting behavior. I have questions.

* **Q1**: Is the behavior reproduced with the following setting?

Yes this is correct, because of my previous issue

bleopt canvas_winch_action=redraw-prev
* **Q2**: What would be output after the following steps?


1. First run `ble/debug/keylog#start`

2. Move between the primary and secondary screens (to reproduce the behavior)

3. Finally run `ble/debug/keylog#end`. This will output to the terminal the information of the bytes that `ble.sh` received between  `ble/debug/keylog#start` and `ble/debug/keylog#end`, along with the decoded results.
❯❯ ble/debug/keylog#end
===== bytes =====
192 155 91 65 192 155 91 65 13

===== chars =====
ESC [ A ESC [ A RET

===== keys =====
up up C-m

P.S.

* **Q3**: With the following setting, does the cursor position go to the top of the screen on moving between the primary and secondary displays?
bleopt canvas_winch_action=clear

With this option I see the terminal screens clearing but only after the prompt is pushed down of one carriage return.

Thanks for the help!

returntrip avatar Feb 17 '22 07:02 returntrip

Thank you for the reply!

Yes this is correct, because of my previous issue

OK. Thanks for the information.

❯❯ ble/debug/keylog#end ===== bytes ===== 192 155 91 65 192 155 91 65 13

===== chars ===== ESC [ A ESC [ A RET

===== keys ===== up up C-m

Thank you! This means that the problem is not related to some terminal sequences for focus-in (CSI I) and focus-out (CSI O) that some terminals send under the DEC mode 1004.

With this option I see the terminal screens clearing but only after the prompt is pushed down of one carriage return.

OK, so this means that Alacritty sends SIGWINCH when the mouse pointer moves between monitors.

I thought that maybe starship also registers the WINCH trap so checked the setups by starship.

[murase@chatoyancy 0 ~]$ bash --norc
[murase@chatoyancy 0 ~]$ eval "$(starship init bash)"

murase in chatoyancy in ~
❯ trap -p
trap -- 'starship_preexec "$_"' DEBUG

murase in chatoyancy in ~
❯ declare -p PROMPT_COMMAND
declare -- PROMPT_COMMAND="starship_precmd"

starship doesn't actually trap WINCH but instead trap DEBUG. It also runs a function through PROMPT_COMMAND. Several hours ago, I just have pushed some fixes related to the interaction between DEBUG and PROMPT_COMMAND.

  • Q4: Could you try the latest master of ble.sh (398e404) by ble-update to see if the behavior changes?

akinomyoga avatar Feb 17 '22 08:02 akinomyoga

TY for the quick reply! I have updated but I still see the carriage return.

returntrip avatar Feb 17 '22 08:02 returntrip

Thank you for your quick responses. I tried to reproduce it in my environment but cannot reproduce it at the moment. I'll later try more, and after that, I think I'll again ask you questions. Thank you.

akinomyoga avatar Feb 17 '22 09:02 akinomyoga