Skip to content

Fix vertical candidate window flickering - #745

Merged
zonble merged 1 commit into
openvanilla:masterfrom
lukhnos:fix-candidate-window-flickering
Nov 18, 2025
Merged

Fix vertical candidate window flickering#745
zonble merged 1 commit into
openvanilla:masterfrom
lukhnos:fix-candidate-window-flickering

Conversation

@lukhnos

@lukhnos lukhnos commented Nov 15, 2025

Copy link
Copy Markdown
Contributor

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.

@lukhnos
lukhnos requested review from Copilot and zonble November 15, 2025 21:53
@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello @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 DispatchQueue, which improves the reliability and consistency of these operations across the application.

Highlights

  • Flickering Fix: Addresses and resolves a flickering issue specifically observed with the vertical candidate window.
  • Window Visibility Timing: Ensures that the candidate window's position is fully determined and set before the window is made visible, preventing it from appearing at an incorrect initial location.
  • Standardized Delayed Actions: Migrates all delayed method invocations to use DispatchQueue.main.asyncAfter, ensuring a consistent and predictable order of execution for deferred UI updates.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Comment thread Packages/CandidateUI/Sources/CandidateUI/CandidateController.swift Outdated
Comment thread Packages/CandidateUI/Sources/CandidateUI/CandidateController.swift Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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:) with DispatchQueue.main.asyncAfter in CandidateController.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

Comment thread Packages/CandidateUI/Sources/CandidateUI/CandidateController.swift Outdated
Comment thread Packages/CandidateUI/Sources/CandidateUI/CandidateController.swift Outdated
@lukhnos
lukhnos force-pushed the fix-candidate-window-flickering branch from b6204d1 to c9fe778 Compare November 15, 2025 21:57
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.
@lukhnos
lukhnos force-pushed the fix-candidate-window-flickering branch from c9fe778 to f486aba Compare November 15, 2025 22:00
@zonble
zonble merged commit 65e5e5e into openvanilla:master Nov 18, 2025
7 checks passed
@lukhnos
lukhnos deleted the fix-candidate-window-flickering branch January 11, 2026 00:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants