Skip to content

知了 Cicada · 任何会议和直播的实时字幕、同声传译、AI 会议纪要,Mac、Windows、Linux、Android 免费开源。Live subtitles, interpreting and meeting notes for any call or stream, on Mac, Windows, Linux and Android.

fix: the toast after Edit line… shows the span an added word changed (in → in now), not a fragment

wquguru194cdd16d753
diff --git a/Sources/Cicada/LiveFixes.swift b/Sources/Cicada/LiveFixes.swift
index c6b0596..c7eb3e2 100644
--- a/Sources/Cicada/LiveFixes.swift
+++ b/Sources/Cicada/LiveFixes.swift
@@ -240,8 +240,11 @@ final class LiveFixes: ObservableObject {
let learned = keep && everywhere && Vocabulary.learnable(heard: e.heard, word: word) != nil
if learned { vocabulary.confirm(heard: e.heard, word: word, source: "user") }
debugLog("fix edited lines=\(targets.count) learned=\(learned)")
- say(learned ? L("已改 \(targets.count) 处:\(e.heard) → \(word),记进词表")
- : L("已改 \(targets.count) 处:\(e.heard) → \(word)"))
+ // A swap reads as the words swapped; an added or dropped word as the span it changed
+ // ("in → in now", not "in → now").
+ let (a, b) = e.swap ? (e.heard, word) : (e.fix.from, e.fix.to)
+ say(learned ? L("已改 \(targets.count) 处:\(a) → \(b),记进词表")
+ : L("已改 \(targets.count) 处:\(a) → \(b)"))
return targets.count
}