Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions addon/appModules/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,16 @@ def message(text):

handler = braille.handler
assert handler
if handler.buffer is handler.messageBuffer:
handler.buffer.clear()
else:
handler.buffer = handler.messageBuffer

region = braille.TextRegion(text)
region.update()
handler.buffer.regions.append(region)
handler.buffer.update()
handler.update()
try:
if handler.buffer is handler.messageBuffer:
handler.buffer.clear()
else:
handler.buffer = handler.messageBuffer

region = braille.TextRegion(text)
region.update()
handler.buffer.regions.append(region)
handler.buffer.update()
handler.update()
except RuntimeError:
log.debug("Braille translation failed for text, skipping braille output", exc_info=True)
Comment on lines +87 to +99
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.

P2 緩衝區狀態在例外發生後可能不一致

handler.buffer 原本不是 handler.messageBuffer(進入 else 分支)時,handler.buffer = handler.messageBuffer 已被執行,但若隨後 region.update() 拋出 RuntimeErrorhandler.messageBuffer 的內容並未被清除,且 handler.buffer 已指向 messageBuffer

雖然因為 handler.update() 從未被呼叫,所以實體點字顯示器不會立刻更新,但 handler.buffer 的指向已悄然改變。若 NVDA 內部其他機制在此之後呼叫 handler.update(),可能會將 messageBuffer 中殘留的舊內容顯示在點字機上。

建議在捕獲例外時,視情況將 handler.buffer 還原:

try:
    original_buffer = handler.buffer
    if handler.buffer is handler.messageBuffer:
        handler.buffer.clear()
    else:
        handler.buffer = handler.messageBuffer

    region = braille.TextRegion(text)
    region.update()
    handler.buffer.regions.append(region)
    handler.buffer.update()
    handler.update()
except RuntimeError:
    handler.buffer = original_buffer  # 還原緩衝區指向
    log.debug("Braille translation failed for text, skipping braille output", exc_info=True)
Prompt To Fix With AI
This is a comment left during a code review.
Path: addon/appModules/_utils.py
Line: 87-99

Comment:
**緩衝區狀態在例外發生後可能不一致**`handler.buffer` 原本**不是** `handler.messageBuffer`(進入 `else` 分支)時,`handler.buffer = handler.messageBuffer` 已被執行,但若隨後 `region.update()` 拋出 `RuntimeError``handler.messageBuffer` 的內容並未被清除,且 `handler.buffer` 已指向 `messageBuffer`。

雖然因為 `handler.update()` 從未被呼叫,所以實體點字顯示器不會立刻更新,但 `handler.buffer` 的指向已悄然改變。若 NVDA 內部其他機制在此之後呼叫 `handler.update()`,可能會將 `messageBuffer` 中殘留的舊內容顯示在點字機上。

建議在捕獲例外時,視情況將 `handler.buffer` 還原:

```python
try:
    original_buffer = handler.buffer
    if handler.buffer is handler.messageBuffer:
        handler.buffer.clear()
    else:
        handler.buffer = handler.messageBuffer

    region = braille.TextRegion(text)
    region.update()
    handler.buffer.regions.append(region)
    handler.buffer.update()
    handler.update()
except RuntimeError:
    handler.buffer = original_buffer  # 還原緩衝區指向
    log.debug("Braille translation failed for text, skipping braille output", exc_info=True)
```

How can I resolve this? If you propose a fix, please make it concise.

Fix in Claude Code Fix in Codex

6 changes: 3 additions & 3 deletions build_addon.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import markdown

ADDON_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "addon")
OUTPUT_NAME = "lineDesktop-1.2.2.nvda-addon"
OUTPUT_NAME = "lineDesktop-1.2.3-beta2.nvda-addon"
OUTPUT_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), OUTPUT_NAME)

# Manifest content matching the format of working NVDA add-ons
Expand All @@ -19,9 +19,9 @@
summary = "LINE Desktop Accessibility"
description = \"\"\"Enhances NVDA accessibility support for the LINE desktop application on Windows.
Provides improved navigation for chat lists, messages, contacts, and message input.\"\"\"
author = "張可揚 <lindsay714322@gmail.com>; 洪鳳恩 <kittyhong0208@gmail.com>"
author = "張可揚 <lindsay714322@gmail.com>; 洪鳳恩 <kittyhong0208@gmail.com>; 蔡頭<tommytsaitou>"
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.

P2 作者欄位格式問題

蔡頭<tommytsaitou> 缺少名稱與角括號之間的空格,且 tommytsaitou 不是有效的電子郵件地址,與其他作者的格式 姓名 <email> 不符。若 NVDA 的附加元件管理員或更新機制解析此欄位,可能發生格式錯誤。

建議修正格式:

Suggested change
author = "張可揚 <lindsay714322@gmail.com>; 洪鳳恩 <kittyhong0208@gmail.com>; 蔡頭<tommytsaitou>"
author = "張可揚 <lindsay714322@gmail.com>; 洪鳳恩 <kittyhong0208@gmail.com>; 蔡頭 <tommytsaitou@example.com>"

請將 tommytsaitou@example.com 替換為實際的電子郵件地址(若無正式電子郵件,可使用 GitHub 的 noreply 格式)。

Prompt To Fix With AI
This is a comment left during a code review.
Path: build_addon.py
Line: 22

Comment:
**作者欄位格式問題**

`蔡頭<tommytsaitou>` 缺少名稱與角括號之間的空格,且 `tommytsaitou` 不是有效的電子郵件地址,與其他作者的格式 `姓名 <email>` 不符。若 NVDA 的附加元件管理員或更新機制解析此欄位,可能發生格式錯誤。

建議修正格式:

```suggestion
author = "張可揚 <lindsay714322@gmail.com>; 洪鳳恩 <kittyhong0208@gmail.com>; 蔡頭 <tommytsaitou@example.com>"
```

請將 `tommytsaitou@example.com` 替換為實際的電子郵件地址(若無正式電子郵件,可使用 GitHub 的 noreply 格式)。

How can I resolve this? If you propose a fix, please make it concise.

Fix in Claude Code Fix in Codex

url = None
version = 1.2.2
version = 1.2.3beta2
changelog = \"\"\"Initial release with LINE desktop accessibility support.\"\"\"
docFileName = readme.html
minimumNVDAVersion = 2019.3
Comment on lines 13 to 27
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.

P2 版本字串格式不一致

OUTPUT_NAME(第 13 行)使用 1.2.3-beta2(含連字號),但 manifest 中的 version(第 27 行)使用 1.2.3beta2(無連字號)。若 NVDA 根據 manifest 中的 version 欄位進行版本比對,使用者看到的檔案名稱與附加元件管理員顯示的版本號將不一致,可能造成混淆。

建議統一格式:

Suggested change
version = 1.2.3-beta2
Prompt To Fix With AI
This is a comment left during a code review.
Path: build_addon.py
Line: 13-27

Comment:
**版本字串格式不一致**

`OUTPUT_NAME`(第 13 行)使用 `1.2.3-beta2`(含連字號),但 manifest 中的 `version`(第 27 行)使用 `1.2.3beta2`(無連字號)。若 NVDA 根據 manifest 中的 `version` 欄位進行版本比對,使用者看到的檔案名稱與附加元件管理員顯示的版本號將不一致,可能造成混淆。

建議統一格式:

```suggestion
version = 1.2.3-beta2
```

How can I resolve this? If you propose a fix, please make it concise.

Fix in Claude Code Fix in Codex

Expand Down
Loading