dotfiles/fish/functions/_pure_string_width.fish

10 lines
283 B
Fish
Raw Normal View History

function _pure_string_width \
--description 'returns raw string length, i.e. ignore ANSI-color' \
--argument-names prompt
set --local empty ''
set --local raw_prompt (string replace --all --regex '\e\[[^m]*m' $empty -- $prompt)
string length -- $raw_prompt
end