dotfiles icon indicating copy to clipboard operation
dotfiles copied to clipboard

Expected prompt length leading to Terminal line overwriting

Open ezramechaber opened this issue 5 years ago • 2 comments

I think this may be a self-created issue, but the battery status addition in my Bash profile seems to be leading to accidental visual line overwrites.

When I wrap the line, Terminal and iTerm have trouble figuring out the length of the line, and it overwrites on top of my existing text, and then if I delete back to the prompt even lets me delete part of the prompt.

Any idea what I might be doing wrong? Are there settings I should be adjusting in either the prompt or battery-status files?

Screen Shot 2019-04-12 at 11 12 29 AM

ezramechaber avatar Apr 12 '19 15:04 ezramechaber

What shell are you using? At least with bash, I believe you need to wrap non-printed characters with \[ \], though I think this may be the case for other shells too. Check out my .bashrc in my dotfiles where I wrapped color "characters" to avoid this same line wrap problem: https://github.com/lkgarrison/dotfiles/blob/1debb2df340b1bfdb1142d9c6c509b0b5582d13b/bash/bashrc.symlink#L28 (as well as a detailed comment explanation)

lkgarrison avatar Sep 10 '19 07:09 lkgarrison

Thanks! I was using Bash (and thought I had properly escaped everything), but I switched to ZSH and am no longer seeing the issue. I wonder if the emojis also needed escaping? On Sep 10, 2019, 3:17 AM -0400, Luke Garrison [email protected], wrote:

What shell are you using? At least with bash, I believe you need to wrap non-printed characters with [ ], though I think this may be the case for other shells too. Check out my .bashrc in my dotfiles where I wrapped color "characters" to avoid this same line wrap problem: https://github.com/lkgarrison/dotfiles/blob/1debb2df340b1bfdb1142d9c6c509b0b5582d13b/bash/bashrc.symlink#L28 (as well as a detailed comment explanation) — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

ezramechaber avatar Sep 10 '19 14:09 ezramechaber