Skip to content

Feat preview color scheme on mouse hover - #18518

Merged
Dustin L. Howett (DHowett) merged 14 commits into
microsoft:mainfrom
eleadufresne:feat-preview-color-scheme-on-mouse-hover
Mar 15, 2025
Merged

Dustin L. Howett (DHowett) merged 14 commits into
microsoft:mainfrom
eleadufresne:feat-preview-color-scheme-on-mouse-hover

Conversation

@eleadufresne

@eleadufresne Éléa Dufresne (eleadufresne) commented Feb 6, 2025 •

Copy link
Copy Markdown
Contributor

Summary of the Pull Request

Allow users to preview color schemes by hovering over them with the mouse pointer in the Command Palette.

Screenshot 2025-02-05 190055

References and Relevant Issues

Detailed Description of the Pull Request / Additional comments

This works by attaching event handlers for PointerEntered and PointerExited to ListViewItem containers. When the mouse pointer moves into the item's bounding area, the PreviewAction handler is triggered to showcase the hovered color scheme. Conversely, when the mouse pointer leaves the item's area, the PreviewAction is executed on the selected item (generally from the UP and DOWN arrows).

Decisions I made, but I'm uncertain about:

  • I coded my solution so that PreviewAction is called on the submenu items, as this is where the color schemes are located. I felt invoking the function for each element was unnecessary, but this approach may make it less flexible for future modifications.
  • I'm attaching pointer event handlers when the data associated with the ListViewItem changes, but there might be a better approach.

Important note:

  • This also provides previews for the other features that the ActionPreviewHandler handles, such as the background opacity of the terminal.

Validation Steps Performed

  • Hover a color scheme, and it becomes the active one.
  • Pressing ESC at any point to dismiss the command palette, and the scheme returns to the previous one.
  • I did not add any additional test, though all existing ColorScheme tests passed.

PR Checklist

@microsoft-github-policy-service microsoft-github-policy-service Bot added Issue-Task It's a feature request, but it doesn't really need a major design. Area-CmdPal Command Palette issues and features Product-Terminal The new Windows Terminal. labels Feb 6, 2025
@eleadufresne

Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree

I added a 10ms delay with a DispatcherTimer to debounce pointer exit events because the preview updates were clunky when quickly moving the pointer between ListViewItems.
@eleadufresne
Éléa Dufresne (eleadufresne) marked this pull request as ready for review February 12, 2025 21:17

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks and feels great! Just the one comment before approving. Thanks for doing this!

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(whoops, clicked the wrong button...)

@microsoft-github-policy-service microsoft-github-policy-service Bot added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Feb 20, 2025
Co-authored-by: Carlos Zamora <carlos.zamora@microsoft.com>
@microsoft-github-policy-service microsoft-github-policy-service Bot removed the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Feb 20, 2025
Updated implementation to call PreviewAction on all command palette items instead of only submenu items, following PR feedback.
@eleadufresne

Copy link
Copy Markdown
Contributor Author

Dustin L. Howett (@DHowett) can you please take a look when you have the chance? Thanks!

@DHowett

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@DHowett

Copy link
Copy Markdown
Member

Éléa Dufresne (@eleadufresne) so sorry for the delay! I've been out sick this week, but I'm putting it at the top of my list

@DHowett

Copy link
Copy Markdown
Member

ah, you may need to run the code formatter :)

i am dismayed that we are no longer allowed to run these things without team approval - it slows down the whole PR process.

@eleadufresne

Éléa Dufresne (eleadufresne) commented Feb 28, 2025 •

Copy link
Copy Markdown
Contributor Author

Dustin L. Howett (@DHowett) Thanks for taking the time to look at it—especially while you’re not feeling great—and apologies for missing this in my last commit. I ran the formatter, so fingers crossed it passes all the checks this time!

By the way, can I run the pipeline myself now, or should it always be handled by someone from the team?

@DHowett

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@DHowett

Copy link
Copy Markdown
Member

unfortunately, it still needs a team member to approve each iteration

@eleadufresne

Copy link
Copy Markdown
Contributor Author

Ah gotchu, thanks for the info!

@eleadufresne

Copy link
Copy Markdown
Contributor Author

Dustin L. Howett (@DHowett), looks like all checks have passed 😄 Thanks again for your help! Let me know if you need anything else before merging.

@lhecker Leonard Hecker (lhecker) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One tiny nit, otherwise LGTM!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great! Thanks so much for doing it, and for being patient with us while we were a bit under-staffed. I can't wait to ship this!

@DHowett

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@DHowett
Dustin L. Howett (DHowett) enabled auto-merge (squash) March 14, 2025 23:24
@DHowett

Copy link
Copy Markdown
Member
  • I'm attaching pointer event handlers when the data associated with the ListViewItem changes, but there might be a better approach.

Honestly, probably not. This is fine with me - so I removed it from the final commit message!

@eleadufresne

Copy link
Copy Markdown
Contributor Author

Dustin L. Howett (@DHowett) No worries at all! It's been a great learning experience, and I appreciate the guidance. Always happy to help; I'm super excited to see this get merged 😄

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

Labels

Area-CmdPal Command Palette issues and features Issue-Task It's a feature request, but it doesn't really need a major design. Product-Terminal The new Windows Terminal.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Request: "Select color scheme..." mouse-hover should provide color-scheme preview

4 participants