Fixing spelling spaces

Samuel Thibault samuel.thibault at ens-lyon.org
Sun Mar 19 17:28:27 EDT 2017


Hello,

Zahari Yurukov, on dim. 19 mars 2017 19:38:39 +0200, wrote:
> > Which command produces this effect?  I'm not getting a "space" spoken
> > with espeakup.
> 
> This is the say character review commands and is only for latin characters with
> direct mode disabled, actually.

Ah without direct mode, ok, now I get them.

> > How do you see this?
> > 
> I thought it's from main.c:
> char spk_str_caps_start[MAXVARLEN + 1] = "\0";
> char spk_str_caps_stop[MAXVARLEN + 1] = "\0";

These strings are actually bogus: "\0" boils down to "" here.

> For example, in main.c, I see this line in several places:
> synth_buffer_add(SPACE);
> Namely in speak_char and in spkup_write.

Ok, the culprit is not really them, but that synth_printf just after
that flushes the synth, and thus the synth is explicitly given the space
alone.

> > In which situations exactly?
> > 
> In addition to "character, say previous/current/next", also with "Say screen" command.
> Also when moving the cursor with the arrow keys over capital letter and when pressing Enter in bash.

Ok, I believe the attached patch should fix all of them by grouping the
writes into just one go?

Samue
-------------- next part --------------
Index: linux-4.10/drivers/staging/speakup/main.c
===================================================================
--- linux-4.10.orig/drivers/staging/speakup/main.c
+++ linux-4.10/drivers/staging/speakup/main.c
@@ -448,20 +448,17 @@ static void speak_char(u16 ch)
 		pr_info("speak_char: cp == NULL!\n");
 		return;
 	}
-	synth_buffer_add(SPACE);
 	if (IS_CHAR(ch, B_CAP)) {
 		spk_pitch_shift++;
-		synth_printf("%s", spk_str_caps_start);
-		synth_printf("%s", cp);
-		synth_printf("%s", spk_str_caps_stop);
+		synth_printf(" %s%s%s ",
+			spk_str_caps_start, cp, spk_str_caps_stop);
 	} else {
 		if (*cp == '^') {
-			synth_printf("%s", spk_msg_get(MSG_CTRL));
 			cp++;
-		}
-		synth_printf("%s", cp);
+			synth_printf(" %s%s ", spk_msg_get(MSG_CTRL), cp);
+		} else
+			synth_printf(" %s ", cp);
 	}
-	synth_buffer_add(SPACE);
 }
 
 static u16 get_char(struct vc_data *vc, u16 *pos, u_char *attribs)


More information about the Speakup mailing list