Skip to content

Support UTF-8 encoded emojis in NINJA_STATUS environment variableΒ #2728

@jthackray

Description

@jthackray

Similar to #713, it would be great if NINJA_STATUS accounted for the width of UTF-8 encoded emojis. I've written a fix for this in #2727 which works for me, so I can use:

  export NINJA_STATUS=$(print -P "%B%F{magenta}🧡%%r πŸš€%%o/s %F{green}⏱️%%w βŒ›%%W %F{cyan}%%f/%%t %F{yellow}%%p%b %F{reset}")

and the full terminal width is used. Ideally, in the patch, I would have used wcwidth() but I believe this isn't available on Windows, so the code assumes UTF-8 emojis are 2 characters in width (apart from control characters), which is true on iTerm2 and probably most other terminal emulators.

I've added new tests for this, and the existing tests continue to pass.

Comments appreciated. Thanks :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions