Skip to content

修正垂直選字窗在開啟聯想詞後頁面錯亂的問題#120

Merged
zonble merged 2 commits intoopenvanilla:masterfrom
lukhnos:candidate-ui-fix
Dec 5, 2025
Merged

修正垂直選字窗在開啟聯想詞後頁面錯亂的問題#120
zonble merged 2 commits intoopenvanilla:masterfrom
lukhnos:candidate-ui-fix

Conversation

@lukhnos
Copy link
Copy Markdown
Collaborator

@lukhnos lukhnos commented Dec 4, 2025

這個 PR 修正從小麥注音同步來的垂直選字窗所帶來的問題。這一段程式碼是九月時帶進來的。問題出在先前計算翻頁後、table view 要捲動到哪一行的程式,只考慮到連續翻頁的情境──但是 OV 的聯想詞模組直接要求翻到第 0 頁(等於是選取第 0 個候選字詞),結果那一段程式就誤算了 table view 要捲動到的行數,並且讓後續的選字窗狀態連帶錯亂。我們在小麥注音中修正了這一段的計算邏輯,在此同步過來。

這個 PR 同時修正一個無關的問題:選字窗在第 0 頁,按 Page Up 時,選字窗應該倒卷至最後一頁,且高亮選取最後一個候選字詞。但先前的邏輯選到的是倒數第二個候選字詞,而不是最後一個。

Fixes #119

@lukhnos lukhnos requested a review from zonble December 4, 2025 19:02
@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!

此拉取請求主要處理垂直候選字選單的兩個相關問題。首先,它修正了候選字清單捲動位置不正確的錯誤,尤其是在聯想詞模組要求顯示第一頁時。其次,它改進了在初始頁面按下「Page Up」鍵時的行為,確保選取能正確地循環到最後一個候選字詞。這些變更旨在提升候選字選取功能的準確性和使用者體驗。

Highlights

  • 候選字清單捲動邏輯修正: 解決了垂直選字窗捲動位置錯誤的問題,特別是當聯想詞模組要求跳轉到第 0 頁時。先前的邏輯僅考慮連續翻頁,導致表格視圖捲動位置計算錯誤,進而影響選字窗的顯示狀態。此修正同步了小麥注音中的相關邏輯。
  • Page Up 行為修正: 修正了在第 0 頁按下 Page Up 鍵時,選字窗會高亮顯示倒數第二個候選字詞,而非正確的最後一個候選字詞的問題。
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.

Copy link
Copy Markdown

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

Choose a reason for hiding this comment

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

Code Review

這個 PR 修正了候選字窗位置錯亂以及 Page Up 倒卷行為的兩個問題。整體的修改邏輯清晰,有效解決了所述問題。我只在 VerticalCandidateController.swift 中發現一個可以讓程式碼更簡潔的小機會,並已在註解中提出建議。除此之外,沒有其他問題。

This fixes openvanilla#119

This is synced from openvanilla/McBopomofo#755
and a detailed analysis of the changes can be found there.
This fixes the bug where Page Up at index 0 went to the *penultimate*
candidate, not the last candidate.
@lukhnos lukhnos changed the title 修正候選字清單位置錯亂的問題 修正垂直選字窗,在開啟聯想詞後,頁面錯亂的問題 Dec 4, 2025
@lukhnos lukhnos changed the title 修正垂直選字窗,在開啟聯想詞後,頁面錯亂的問題 修正垂直選字窗在開啟聯想詞後頁面錯亂的問題 Dec 4, 2025
@zonble zonble merged commit 6a39a30 into openvanilla:master Dec 5, 2025
@lukhnos lukhnos deleted the candidate-ui-fix branch December 5, 2025 05:26
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.

候選字清單的預設位置錯亂

2 participants