Skip to content

fix: append SGR reset to dsuf to prevent background color bleed - #570

Merged
Aloxaf merged 1 commit into
Aloxaf:masterfrom
birkhofflee:fix/color-reset-bleed
Mar 17, 2026
Merged

Aloxaf merged 1 commit into
Aloxaf:masterfrom
birkhofflee:fix/color-reset-bleed

Conversation

@birkhofflee

Copy link
Copy Markdown
Contributor

Summary

Fixes #563.

In lib/-ftb-colorize, the ANSI color sequence opened in dpre is never terminated in dsuf, causing background colors (e.g. from vivid's LS_COLORS themes) to bleed into the first character of the following entry in the fzf list.

Changes

  • Symlink branch: append \033[0m after the resolved path in dsuf
  • Non-symlink branch: prepend \033[0m to dsuf
   dpre=$'\033[0m\033['$sym_color'm'
-  dsuf+=$'\033[0m -> \033['$rsv_color'm'$rsv
+  dsuf+=$'\033[0m -> \033['$rsv_color'm'$rsv$'\033[0m'
 else
   dpre=$'\033[0m\033['$REPLY'm'
+  dsuf=$'\033[0m'$dsuf
 fi

Note: The C module (fzf-tab-candidates-generate builtin) already appends \033[0m to dsuf in fzftab.c:454, so it is unaffected by this bug.

In lib/-ftb-colorize, the color opened in dpre was never closed in dsuf,
causing background colors (e.g. from vivid LS_COLORS themes) to bleed
into the first character of the following entry in the fzf list.

- Symlink branch: append \033[0m after the resolved path in dsuf
- Non-symlink branch: prepend \033[0m to dsuf

Note: the C module (fzf-tab-candidates-generate builtin) already appends
\033[0m to dsuf in fzftab.c:454 so it is unaffected.

Fixes: Aloxaf#563
@Aloxaf
Aloxaf merged commit 0983009 into Aloxaf:master Mar 17, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Background color from LS_COLORS bleeds into first character of next entry

2 participants