Fix vertical candidate window flickering - #745
Conversation
Summary of ChangesHello @lukhnos, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request focuses on enhancing the user experience by eliminating an annoying flickering artifact in the vertical candidate window. The core changes involve reordering the sequence of operations to guarantee that the window's layout is finalized before it's displayed. Additionally, it refactors the mechanism for scheduling delayed UI tasks to use Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request addresses a flickering issue with the candidate window by ensuring the window's position is set before it becomes visible. This is achieved by reordering operations in InputMethodController.swift. Additionally, it standardizes on using DispatchQueue for delayed operations in CandidateController.swift, which is a good move for consistency.
My review includes a couple of suggestions to simplify the DispatchQueue calls for better code clarity. Overall, the changes look good and address the stated problem.
There was a problem hiding this comment.
Pull Request Overview
This PR fixes flickering issues with the vertical candidate window by ensuring the window position is set before making it visible. The changes also standardize delayed method invocation to use DispatchQueue.main.asyncAfter for consistent execution order.
- Move visibility setting to occur after position calculation in
InputMethodController.swift - Replace
NSObject.perform(_:with:afterDelay:)withDispatchQueue.main.asyncAfterinCandidateController.swift
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| Source/InputMethodController.swift | Moves visible = true to execute after window position is set via set(windowTopLeftPoint:bottomOutOfScreenAdjustmentHeight:) |
| Packages/CandidateUI/Sources/CandidateUI/CandidateController.swift | Replaces perform(_:with:afterDelay:) with DispatchQueue.main.asyncAfter for ordering window visibility operations |
b6204d1 to
c9fe778
Compare
The flickering issue is more often found with the vertical candidate window, likely due to the layout passes it needs to go through. This PR makes sure that candidate window position is first set before the window becomes visible. This PR also switches to use dispatch queue for all delayed method invocation. This makes sure that all such deferred actions are put in the same queue, and so they will be performed in the expected order.
c9fe778 to
f486aba
Compare
The flickering issue is more often found with the vertical candidate window, likely due to the layout passes it needs to go through. This PR makes sure that candidate window position is first set before the window becomes visible.
This PR also switches to use dispatch queue for all delayed method invocation. This makes sure that all such deferred actions are put in the same queue, and so they will be performed in the expected order.