Skip to content

color codes break gum filter match foreground #689

@DarioDarko

Description

@DarioDarko

Describe the bug
using escape codes to color text breaks gum filter. typing 'm' 'b' or '[' as first character messes with the color output of match.foreground. disabling match highlighting with --match.foreground="" gets rid of the issue, but highlighting would be nice

this also affects other highlighting styles, i think all of them

i could not reproduce the problem in xterm for some reason, alacritty seems to handle color escape codes differently. not sure about other terminal emulators

To Reproduce

red=$(tput setaf 1)
green=$(tput setaf 2)
reset=$(tput sgr0)

{
	echo "normal text"
	echo "${red}red text${reset}"
	echo "${green}green text${reset}"
} | gum filter

Expected behavior
highlight colored text without breaking the escape code

Screenshots
image

Desktop (please complete the following information):

  • OS: EndeavourOS
  • Terminal: Alacritty
  • Version: gum version 0.14.5 (1917023)

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