Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat preview color scheme on mouse hover #18518

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

eleadufresne
Copy link
Contributor

@eleadufresne eleadufresne commented Feb 6, 2025

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
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 eleadufresne marked this pull request as ready for review February 12, 2025 21:17
Copy link
Member

@carlos-zamora carlos-zamora left a comment

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
Member

@carlos-zamora carlos-zamora left a comment

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
@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.
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
2 participants