Selected match in HTML tag is indistinguishable from non-selected matches in dark terminals

Open
#21,406 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 13 days

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
55/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
vim
Domain
tooling

Research direction

Reproduce with vim --clean index.html in a dark terminal, enable hlsearch, and search for /meta while cycling with CTRL-G/CTRL-T. Compare the selected and non-selected matches with and without termguicolors; done means the selected match is clearly distinguishable in dark terminals without requiring further configuration.

Written by the indexing model from the issue text.

Description

bug
Steps to reproduce

For this reproduction, I'm using the MDN's basic HTML template.

  1. Ensure the terminal emulator is in dark style/mode
    For GNOME Console and Ptyxis, this can be done from the main menu (F10). Ptyxis users should also set the GNOME colour palette in preferences (Ctrl+,), under the 'Appearance' tab.
    For Konsole, ensure your profile's colour scheme is 'Breeze', which is the default for the 'Built-in' profile.
  2. Edit the HTML file with Vim using vim --clean index.html
  3. Enable hlsearch with :set hlsearch
  4. Perform a search for /meta without pressing <Enter>
  5. Cycle between the results with CTRL-G/CTRL-T

All matches are visually indistinguishable (black text with yellow highlight), making it impossible to tell which is selected without further configuration.

This is not an issue in light style/mode.

Expected behaviour

When the terminal emulators (Ptyxis, GNOME Console, and Konsole) are in light style/mode, Vim colours the meta text a darker shade of yellow. This distinction is important since the selected match is highlighted by reversing the text and background colour, while the non-selected matches simply use a light shade of yellow.

This means the match highlighting behaviour differs between light/dark terminal emulators:

  • In light style/mode: the selected match is a dark shade of yellow, the non-selected matches are a light shade of yellow.
Image
  • In dark style/mode: all matches (selected, non-selected) share the same light shade of yellow. They're visually indistinguishable.
Image

I'd expect the difference to be equally obvious when the terminal emulator is in dark style/mode.

I should note that setting termguicolors does make the selected match distinguishable in dark style/mode, as its background now adopts a slightly darker shade of yellow then the non-selected matches. Though it's certainly not a fix, since it remains difficult to discern the difference.

Version of Vim

9.2.1119

Environment

Operating system: Fedora Linux 43 (Workstation Edition)
Terminal: Ptyxis 49.3 (Fedora Workstation default, primary), GNOME Console 49.2, Konsole 26.08.0
Value of $TERM: xterm-256color
Shell: fish, version 4.2.0

Thank you for this wonderful software.

Dominant language
Vim Script
Stars
41.4k
Forks
6.2k
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from vim/vim

All issues in vim/vim

Similar issues

More DevTools issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.