@@ -590,23 +590,22 @@ pub fn do_navigate_command_string(mathml: Element, nav_command: &'static str) ->
590590 // Speak/Overview of where we landed (if we are supposed to speak it) -- use intent, not nav_intent
591591 // Note: NavMode might have changed, so we need to recheck the mode to see if we use LiteralSpeak
592592 let literal_speak = nav_state. mode == "Character" ;
593- let node_speech = match speak ( mathml, intent, & nav_position, literal_speak, use_read_rules) {
593+ let node_speech_result = speak ( mathml, intent, & nav_position, literal_speak, use_read_rules) ;
594+ remove_literal_property ( mathml, add_literal, properties) ;
595+ let node_speech = match node_speech_result {
594596 Ok ( speech) => speech,
595597 Err ( e) => {
596- remove_literal_property ( mathml, add_literal, properties) ;
597598 if e. to_string ( ) == crate :: speech:: NAV_NODE_SPEECH_NOT_FOUND {
598599 bail ! ( "Internal error: With {}/{} in {} mode, can't {} from expression with id '{}' inside:\n {}" ,
599600 rules. pref_manager. as_ref( ) . borrow( ) . pref_to_string( "Language" ) ,
600601 rules. pref_manager. as_ref( ) . borrow( ) . pref_to_string( "SpeechStyle" ) ,
601602 & nav_state. mode, nav_command, & nav_position. current_node, mml_to_string( if literal_speak { mathml} else { intent} ) ) ;
602- } else {
603- return Err ( e) ;
604603 }
605- } ,
604+ return Err ( e) ;
605+ }
606606 } ;
607- remove_literal_property ( mathml, add_literal, properties) ;
608607
609- // debug!("node_speech: '{}'", node_speech);
608+ // debug!("node_speech: '{}', speech: '{}'\n ", node_speech, speech );
610609 if node_speech. is_empty ( ) {
611610 // try again in loop
612611 return Ok ( ( speech, false ) ) ;
@@ -1004,8 +1003,10 @@ mod tests {
10041003 NAVIGATION_STATE . with ( |nav_stack| {
10051004 let ( start_id, _) = nav_stack. borrow ( ) . get_navigation_mathml_id ( mathml) ;
10061005 match do_navigate_command_string ( mathml, command) {
1007- Err ( e) => panic ! ( "\n Starting at '{}', '{} failed.\n {}" ,
1008- start_id, command, & crate :: interface:: errors_to_string( & e) ) ,
1006+ Err ( e) => {
1007+ panic ! ( "\n Starting at '{}', '{} failed.\n {}" ,
1008+ start_id, command, & crate :: interface:: errors_to_string( & e) )
1009+ } ,
10091010 Ok ( nav_speech) => {
10101011 let nav_speech = nav_speech. trim_end_matches ( & [ ' ' , ',' , ';' ] ) ;
10111012 // debug!("Full speech: {}", nav_speech);
@@ -1317,7 +1318,6 @@ mod tests {
13171318
13181319 #[ test]
13191320 fn move_to_start ( ) -> Result < ( ) > {
1320- init_logger ( ) ;
13211321 let mathml_str = "<math id='math'><mfrac id='mfrac'>
13221322 <mrow id='num'><msup id='msup'><mi id='base'>b</mi><mn id='exp'>2</mn></msup><mo id='factorial'>!</mo></mrow>
13231323 <mi id='denom'>d</mi>
0 commit comments