holman / dotfiles

@holman does dotfiles
http://zachholman.com/2010/08/dotfiles-are-meant-to-be-forked/
MIT License
7.35k stars 3.36k forks source link

Expected prompt length leading to Terminal line overwriting #318

Open ezramechaber opened 5 years ago

ezramechaber commented 5 years ago

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

lkgarrison commented 5 years ago

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)

ezramechaber commented 5 years ago

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 notifications@github.com, 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.