iOS: Text-Scan zerlegt Bloecke in einzelne Zeilen
Ein erkannter Textblock konnte mehrere Zeilen enthalten; die Auswahl uebernahm dann mehrzeiligen Text. Jetzt wird strikt in einzelne Zeilen zerlegt, sodass jede Auswahl genau eine Zeile ist. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -99,7 +99,10 @@ struct TextScanView: View {
|
||||
ZStack(alignment: .bottom) {
|
||||
if Self.isSupported {
|
||||
TextLinesScannerRepresentable { erkannt in
|
||||
for t in erkannt.reversed() {
|
||||
// Ein erkannter Textblock kann mehrere Zeilen umfassen – strikt
|
||||
// in einzelne Zeilen zerlegen, damit jede Auswahl genau eine ist.
|
||||
let einzeln = erkannt.flatMap { $0.components(separatedBy: .newlines) }
|
||||
for t in einzeln.reversed() {
|
||||
let sauber = t.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
guard sauber.count >= 2, !zeilen.contains(sauber) else { continue }
|
||||
zeilen.insert(sauber, at: 0)
|
||||
|
||||
Reference in New Issue
Block a user