Inverted CheckRuleFiles condition in SpeechRules::replace_single_char causes unicode-full.yaml to reload when CheckRuleFiles is "None"

オープン 初心者向け
#996 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
1/5
見積もり時間
1時間未満
初心者へのやさしさ
84/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
rust
領域
accessibility

調査の方向性

src/speech.rsを読み、SpeechRules::replace_single_char内のCheckRuleFiles条件を、SpeechRules::updateおよびread_files内のチェックと比較してください。issueの説明どおりに条件を変更し、ルールファイルの読み込みと単一文字の置換に関する該当テストを実行してください。"None"がファイルのタイムスタンプを無視し、"All"が引き続きファイルの変更を検出すれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Summary

In src/speech.rs, SpeechRules::replace_single_char has an inverted equality check when computing should_ignore_file_time:

let should_ignore_file_time = pref_manager.pref_to_string("CheckRuleFiles") == "All";

Every other rule loader in src/speech.rs (such as SpeechRules::update and read_files) uses != "All":

let should_ignore_file_time = pref_manager.pref_to_string("CheckRuleFiles") != "All";
Impact
  1. When CheckRuleFiles: "None" (recommended for environments where rule files are static or loaded from in-memory archives/zip files):
    • should_ignore_file_time evaluates to false instead of true inside replace_single_char.
    • is_file_up_to_date checks the file's modification timestamp on every character lookup that falls back to unicode-full.yaml (such as Mathematical Italic characters 𝑥, 𝑎, 𝑏, 𝑐 after canonicalization).
    • In environments where rule files are backed by an in-memory filesystem or lack valid modification timestamps (returning UNIX_EPOCH), is_file_up_to_date returns false on every call, causing MathCAT to re-parse the ~6,500-entry unicode-full.yaml file on every single character lookup (~30ms per character on mobile devices, adding 200–480ms of latency per expression or navigation step).
  2. When CheckRuleFiles: "All":
    • should_ignore_file_time evaluates to true, so edits to unicode-full.yaml are ignored instead of being reloaded.
Proposed Fix

In src/speech.rs inside SpeechRules::replace_single_char, change == "All" to != "All":

-        let should_ignore_file_time = pref_manager.pref_to_string("CheckRuleFiles") == "All";
+        let should_ignore_file_time = pref_manager.pref_to_string("CheckRuleFiles") != "All";
主要言語
Rust
スター
131
フォーク
97
平均マージ
21時間 45分
マージ済み PR(30日)
95

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

daisy/MathCAT のほかの issue

daisy/MathCAT の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。