Skip to content

Coloring doesn't change on auto suggestions #789

Description

@tomasnorre

Describe the bug

After updating to Ubuntu 24.04, I don't get color changes anymore on auto-suggestions. See screenshot.

To Reproduce

Steps to reproduce the behavior:

Sorry haven't found a way to reproduce this. But setting it up from scrats on a new VM it's working like expected. So it's probably something local. :(

Expected behavior

I would expect the coloring to change, to the primary color as before the update.

Screenshots

zsh-autosuggestions-coloring

Desktop

I run following versions:

  • Ubuntu 24.04 (Budgie Edition)
  • kitty 0.32.2
  • zsh 5.9
  • oh-my-zsh (commit: b1c5315)
  • zsh-autosuggestion (commit: c3d4e57)

Activity

  1. tomasnorre commented on Sep 11, 2024

    @tomasnorre
    Author

    I can confirm that the PR fixes my problem.

  2. PatTheMav commented on Jun 11, 2025

    @PatTheMav

    As a little side note: In a terminal with 24-bit colour support zle can and will accept RGB hash values for colours, but it seems that using such a color for ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE will also break in a similar way and not reset to the "original" colour.

    Changing the environment variable to a xterm colour table value makes it work as intended.

    My hunch is that the hash character will introduce issues with the region highlight code in other ways, because the changes suggested by #790 do not seem to fix that particular issue.

    EDIT: Just confirmed this locally with a simple zsh array that contained string elements that contained a hash symbol. The form ${<array>:#<match>} will not match a string that contains a hash and thus any regions added using RGB hex notation for a colour will not be removed and the region_highlight array will fill up with the same colour regions for different regions.

    The solution suggested in #790 is also not viable if other regions are added (e.g. when using this in conjunction with zsh-syntax-highlighting) as the most recent region in the array might have been added by another plugin.

    Zsh 5.9 supports adding a memo token that can be used instead (and allows a plugin to "tag" its own regions), but it's not supported by Zsh 5.8 and older and can break on those versions when an unexpected memo token is encountered in the region string.

    So for the time being one either has to make sure to only use xterm colour table values (and not use RGB hash colours) or fix this by iterating over all region_highlight elements and explicitly do a string comparison for each and append any non-matching region to a temporary array, before replacing region_highlight with that temporary array.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions