From 331bce8d6e4fe2cc22c376fe5726aab7dac94f18 Mon Sep 17 00:00:00 2001 From: mgros Date: Sat, 24 Oct 2026 04:35:36 +0200 Subject: [PATCH] simplify conditions for escape_string_for_safety --- src/speech.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/speech.rs b/src/speech.rs index 631b6266..253c1dc4 100644 --- a/src/speech.rs +++ b/src/speech.rs @@ -2855,9 +2855,8 @@ impl<'c, 's:'c, 'r, 'm:'c> SpeechRulesWithContext<'c, 's,'m> { } self.translate_count = 0; // not in loop // debug!("*** Did not find unicode {} for char '{}'/{:#06x}", rules.name, ch, ch_as_u32); - if rules.translate_single_chars_only || ch.is_ascii() { // speech or if braille, avoid loop (ASCII remains ASCII if not found) - return Ok(self.escape_string_for_safety(String::from(ch))); - } else if ('\u{2800}'..='\u{28ff}').contains(&ch) { // braille -- leave as braille + if rules.translate_single_chars_only || ch.is_ascii() || // speech or if braille, avoid loop (ASCII remains ASCII if not found) + ('\u{2800}'..='\u{28ff}').contains(&ch) { // braille -- leave as braille return Ok(self.escape_string_for_safety(String::from(ch))); } else { // Emulate what NVDA does: generate (including single quotes) '\xhhhh' or '\yhhhhhh' let prefix_indicator = if ch_as_u32 < 1<<16 {'x'} else {'y'};