geometry-zsh / geometry

geometry is a minimal, fully customizable and composable zsh prompt theme
ISC License
920 stars 94 forks source link

Ignore character modifying codes in the prompt. #216

Closed frm closed 6 years ago

frm commented 6 years ago

Why:

This change addresses the need by:

Notes:

frm commented 6 years ago

One possible alternative would be to recommend users to use other alternatives for bold characters. %BX%f would be equivalent and would allow us to use a substitution mechanism similar to the adam2 one I linked. It feels a bit better do that instead of this, which feels a bit hackish.

It would a matter of changing one line to

local symbol_width="${#${(S%%)prompt_symbol//(\%([KF1]|)\{*\}|\%[Bbkf])}}"
jedahan commented 6 years ago

I think this refactor is generally better than our current state, both in that it helps a user, and is easier to read with the split up variables. We can revisit in the future but I am fine with this hack being merged sooner than later.

frm commented 6 years ago

Here's a preview of the support:

screen shot 2018-07-02 at 21 22 26

When merging I'd rather squash and keep the first commit message, as it provides context for everything, when looking through the git log 😄

jedahan commented 6 years ago

Ahh squash & merge makes sense. This looks good to me