Skip to content

Unsetting $fish_emoji_width doesn't clear the cached width #8274

@lilyball

Description

@lilyball

Latest fish master (3.3.1-288-g139b74d8e)

Setting $fish_emoji_width overrides the guessed emoji width. This override is cached globally. Unsetting it does not clear the cache.

> string length -V \U0001F44D
2
> set fish_emoji_width 1
> string length -V \U0001F44D
1
> set -e fish_emoji_width
> string length -V \U0001F44D
1

Another effect of this bug is that changing the variable in a local scope poisons the cache for the outer scope:

> string length -V \U0001F44D
2
> begin; set -l fish_emoji_width 1; string length -V string length -V \U0001F44D; end
1
> set -S fish_emoji_width
> string length -V \U0001F44D
1

It looks like I can set fish_emoji_width to 0 and this will cause fish to fall back to using the cached emoji guess (assuming it already guessed at emoji prior to setting the variable). So the workaround here looks like set fish_emoji_width 1; set -e fish_emoji_width in order to clear the cached width and then clear the variable.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions