Comments (11)
This is a duplicate report. This is the intended behavior. The behavior of the plain Bash has a problem, but there is no perfect design for the behavior. Currently, ble.sh intensionally behaves in a way different from the plain Bash by default. See #173 (comment):
This is actually a duplicate of #142, #154, and #168. This is somewhat an intended behavior. If you would like the behavior the same as Readline, you can use the following setting:
# blerc bleopt canvas_winch_action=redraw-prev
The reasoning for the default behavior is explained at #142 (comment). This is related to the general problem of terminal text reflowing. There is a nice summary of the problem in README of powerlevel10k.
For an illustration of the problem, you can also check the videos in #142 (comment).
from ble.sh.
Thanks for the reply.
While I understand why it works this way, I tried the change you suggested and it doesn't seem to have any effect.
I tested whether the change had been made by running 'bleopt canvas_winch_action
' in the terminal and the response is 'redraw-prev
'!
Thanks.
from ble.sh.
I tried the change you suggested and it doesn't seem to have any effect.
I tested whether the change had been made by running 'bleopt canvas_winch_action
' in the terminal and the response is 'redraw-prev
'!
Then, I need to investigate how to reproduce the problem. Currently, in my environment, I cannot reproduce the reported behavior with bleopt canvas_winch_action=redraw-prev
.
Could you give me the following information?
- Q1: What are your terminal and its version?
- Q2: What is the operating system?
- Q3: What are the results of the following commands?
$ ble/widget/display-shell-version
$ bleopt prompt_rps1
$ echo "$PS1" | cat -v
$ echo "${PS1@P}" | cat -v
from ble.sh.
I tried the change you suggested and it doesn't seem to have any effect.
I tested whether the change had been made by running 'bleopt canvas_winch_action
' in the terminal and the response is 'redraw-prev
'!Then, I need to investigate how to reproduce the problem. Currently, in my environment, I cannot reproduce the reported behavior with
bleopt canvas_winch_action=redraw-prev
.Could you give me the following information?
* **Q1**: What are your terminal and its version?
Windows Terminal (Running Ubuntu 22.04 under WSL2)
* **Q2**: What is the operating system?
Windows 10 x65 (Hosting Ubuntu 22.04 on WSL2)
* **Q3**: What are the results of the following commands?
$ ble/widget/display-shell-version:
GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu) [Ubuntu 22.04.3 LTS]
ble.sh, version 0.4.0-devel4+d1a1d53 (noarch) [git 2.34.1, GNU Make 4.3, GNU Awk 5.1.0, API: 3.0 (GNU MPFR 4.1.0, GNU MP 6.2.1)]
bash-completion, version 2.11 (hash:b42f5d6a7ad6d4921ec73838ba54a96d6bd30936, 77071 bytes) (noarch)
fzf key-bindings, (hash:b75f1be28c396a7d054110267ee0ea679b2d73b1, 5538 bytes) (noarch) (integration: on)
fzf completion, (hash:db84e06a1ee5fb43bc6ad1aaeec6657cad79c917, 14523 bytes) (noarch) (integration: on)
bash-preexec, (hash:6f26569a9b8f5a7a28f7b3c74796e606e89594c7, 14256 bytes) (noarch)
locale: LANG=en_US.UTF8
terminal: TERM=xterm-256color wcwidth=15.0-west/15.1-2+ri, wt:0 (0;10;1)
$ bleopt prompt_rps1:
bleopt prompt_rps1='\q{contrib/git-state}'
$ echo "$PS1" | cat -v:
${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]$([[ -v BLE_VERSION ]] && echo " \g{fg=red,italic}\q{contrib/elapsed}\g{} ")\n\$
$ echo "${PS1@P}" | cat -v:
^A^[[01;32m^Brafaeldominiquini@ubuntu^A^[[00m^B:^A^[[01;34m^B~^A^[[00m^B \g{fg=red,italic}\q{contrib/elapsed}\g{} ^M
$
This is just a nuisance to me. I don't think it's worth spending time investigating!
Thanks
from ble.sh.
Is this similar to what you observe?
Unfortunately, this is inevitable when the right prompt is present. The same behavior is observed in zsh with right prompts (as described in README of romkatv/powerlevel10k
). This is not specific to ble.sh.
from ble.sh.
I don't tested inside a git repository:
- I tested this with and without this settings (
bleopt canvas_winch_action=redraw-prev
) and it appears that it don't make any difference!
Thanks.
from ble.sh.
I cannot reproduce the reported behavior outside the git repositories. With both redraw-prev
and redraw-here
(default) for a value of canvas_winch_action
, nothing changes in the terminal content in resizing.
- Q4: Can you reproduce the problem with an empty
bleopt prompt_rps1=''
? - Q5: Can you reproduce the problem with simple prompt settings such as
PS1='\$ '
andbleopt prompt_rps1=''
? - Q6: Can you reproduce the problem with the minimal settings, where
~/.bashrc
and~/.blerc
only contain the prompt settings and the line of "source ble.sh"?
from ble.sh.
I cannot reproduce the reported behavior outside the git repositories. With both
redraw-prev
andredraw-here
(default) for a value ofcanvas_winch_action
, nothing changes in the terminal content in resizing.* **Q4**: Can you reproduce the problem with an empty `bleopt prompt_rps1=''`?
Yes, but only the prompt duplication. The terminal doesn't break alignment anymore!
* **Q5**: Can you reproduce the problem with simple prompt settings such as `PS1='\$ '` and `bleopt prompt_rps1=''`?
Yes, but only the duplication of the prompt!
* **Q6**: Can you reproduce the problem with the minimal settings, where `~/.bashrc` and `~/.blerc` only contain the prompt settings and the line of "source ble.sh"?
No. I found what is causing the bug! I added the function to my 'PROMPT_COMMAND' to print a new line before any prompt is drawn:
function __ps1_newline {
if [[ -z "${PS1_NEWLINE}" ]]; then
PS1_NEWLINE=true
else
printf '\n'
fi
}
PROMPT_COMMAND+=(__ps1_newline)
I'll try to fix that here! Sorry for the bug report. It was my configuration that was causing this issue.
Thanks!
from ble.sh.
I see.
function __ps1_newline { if [[ -z "${PS1_NEWLINE}" ]]; then PS1_NEWLINE=true else printf '\n' fi } PROMPT_COMMAND+=(__ps1_newline)
I think what you try to achieve with the above is similar to the effect of bleopt prompt_ruler
in ble.sh:
# blerc
bleopt prompt_ruler=empty-line
from ble.sh.
I have done that:
function __ps1_preexec {
PS1_NEWLINE=true
}
function __ps1_precmd {
if [[ $PS1_NEWLINE = true ]]; then
PS1_NEWLINE=false
printf '\n'
fi
}
preexec_functions+=(__ps1_preexec)
precmd_functions+=(__ps1_precmd)
But your solution is better!
Thanks! I will close this issue now!
from ble.sh.
I had a similar issue and this really helped! I love the prompt ruler feature so much!
from ble.sh.
Related Issues (20)
- Exit status 1 when using pipe and grep HOT 6
- [Alacritty v0.7.0-0.13.1] Newlines inserted when scrolling up HOT 16
- Sabbrev expansions not working HOT 8
- Disable option completion HOT 4
- [WINCH in ble/prompt/update] Cyclic dependency error HOT 13
- Moving down through history gets stuck in multiline HOT 2
- Cannot bind RET in nsearch mode HOT 3
- Kitty's terminal protocol & complete_menu_complete_opts HOT 7
- Incorrect behaviour with C-w HOT 4
- Always one frame (16.7ms) delay between pressing enter and running command HOT 10
- C-RET never works HOT 6
- ln=target in LS_COLORS breaks ble.sh autocomplete highlight HOT 3
- [zellij 0.40.1] Zellij HOT 2
- [tealdeer 1.61] the tldr completion produces errors and a few questions HOT 18
- Simplify README HOT 3
- [kitty] <ESC> do not return to Normal mode HOT 3
- Checking for b2sums lead to strange text below command line prompt HOT 3
- Feature request: Visible bell (vbell) after command line HOT 1
- Slow history navigation HOT 4
- Errors and failure from `bleopt complete_menu_style` HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ble.sh.