akinomyoga / ble.sh

Bash Line Editor―a line editor written in pure Bash with syntax highlighting, auto suggestions, vim modes, etc. for Bash interactive sessions.
BSD 3-Clause "New" or "Revised" License
2.72k stars 86 forks source link

How to disable "[ble: press RET to continue]" prompt? #304

Closed adoyle-h closed 1 year ago

adoyle-h commented 1 year ago

I'm using https://github.com/lincheney/fzf-tab-completion . When pressed ls<Tab>, the ble.sh prints [ble: press RET to continue]. I want to disable this prompt.

CleanShot 2023-03-16 at 21 52 56@2x
akinomyoga commented 1 year ago

I'm using https://github.com/lincheney/fzf-tab-completion . When pressed ls<Tab>,

I tried that setting with bind -x '"\t": fzf_bash_completion' but cannot reproduce the problem. How did you set up fzf-tab-completion?

the ble.sh prints [ble: press RET to continue]

This message is supposed to be only printed when the redirection of stderr is failing due to some setup issues or due to the crash of ble.sh. Since your setup in #303 seems to have some problems with the redirections of stderr and stdout, I suspect that affects the behavior of the fzf-tab-completion binding. How do you source ble.sh currently?

adoyle-h commented 1 year ago

fzf-tab-completion

Load below content with 1> >(...) and 2> >(...) redirections mentioned in #303 .

source fzf-tab-completion/bash/fzf-bash-completion.sh

bind -x '"\t": fzf_bash_completion'
_fzf_bash_completion_loading_msg() {
  printf '%b%s \n' "${PS1@P}" "${READLINE_LINE}"  | tail -n 1
}

The _fzf_bash_completion_loading_msg is used for keeping the origin PS1 prompt. Otherwise the fzf-tab-completion will print Loading matches ... when completing.

ble.sh

source ble/share/blesh/ble.sh &> "$(tty)"
akinomyoga commented 1 year ago
_fzf_bash_completion_loading_msg() {
  printf '%b%s \n' "${PS1@P}" "${READLINE_LINE}"  | tail -n 1
}

Ah, so you are outputting PS1. The variable PS1 is set to a different value [ble: press RET to continue] while the user inputs are processed. So far, I haven't think users might want to access PS1 through keybindings.

If you just wanted to disable it, you could remove the above "${PS1@P}" (and the corresponding %b in the format string).

In commit 2eadcd5b, I changed PS1 to be restored to the user's value while running bind -x commands. Could you check the behavior?

adoyle-h commented 1 year ago

It get fixed in 2eadcd5. I appreciate your help.

I need to use PS1 because fzf_bash_completion erase the cursorline to print _fzf_bash_completion_loading_msg. So I need to refill the PS1 text.

akinomyoga commented 1 year ago

Thanks for checking!