Skip to content

fix(menu): Don't apply selected_text style to matched text in suggestions - #994

Merged
fdncred merged 1 commit into
nushell:mainfrom
ysthakur:reset-before-match-style
Dec 31, 2025
Merged

fdncred merged 1 commit into
nushell:mainfrom
ysthakur:reset-before-match-style

Conversation

@ysthakur

Copy link
Copy Markdown
Member

#798 broke completion menu highlighting, which included making it so that the selected_text style was applied to matched text. #991 tried fixing #798 but missed the matched text problem. This PR makes it so that matched text only has the text and match/selected_match styles applied to it.

This is just a temporary fix. This works for now because suggestion values can't contain ANSI escapes, but once we start allowing suggestions to provide a separate display value with ANSI escapes, we need to handle the Reset attribute (0). It would also be good to handle consecutive ANSI escapes, but that one's not necessary.

Testing

Here's what Nushell looks like after this PR:

image

Nushell config:

  {
    name: completion_menu
    only_buffer_difference: false
    marker: $" \n❯ (char -u '1f4ce') "
    type: {
      layout: columnar
      columns: 4
      col_width: 20   # Optional value. If missing all the screen width is used to calculate column width
      col_padding: 2
      tab_traversal: "vertical"   # Direction in which pressing <Tab> will cycle through options, "horizontal" or "vertical"
    }
    style: {
      text: { fg: "#33ff00" }
      selected_text: {attr: r}
      description_text: yellow
      match_text: {attr: u}
      selected_match_text: {fg: darkorange attr: b}
    }
  }

@ysthakur ysthakur added bug Something isn't working A-Completions Area: Tab completion and inline hint completions labels Dec 31, 2025
@fdncred

fdncred commented Dec 31, 2025

Copy link
Copy Markdown
Contributor

cool. looks better! thanks!

@fdncred
fdncred merged commit 4d14e5d into nushell:main Dec 31, 2025
6 checks passed
@ysthakur
ysthakur deleted the reset-before-match-style branch December 31, 2025 13:15
kronberger-droid pushed a commit to skull-squadron/reedline that referenced this pull request Jun 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Completions Area: Tab completion and inline hint completions bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants