Open Abkwreu opened 2 years ago
Seems like this issue comes from retrospective add/remove space being a different type of macro from the rest, while others have the format of {:something:something}
, retroactive add/remove space start with =. Retroactive spacing also isn't in _parse_meta
in plover/formatting.py, which seems to handle every macro except retroactive add/remove space, retroactive asterisk, and repeat stroke.
There also seems to be something going on with them being in the same definition: if I do them as separate strokes {*!}
followed by {*-|}
does what I'd expect: it turns "now you can" into "now Youcan". But the other way around (doing the capitalization first) turns "now you can" into "now you Can" instead of the expected "now youCan".
Also, the order should matter, shouldn't it? It seems to me that attaching first should then capitalize the whole joined word, while capitalizing first should capitalize and then attach leaving the capitalized letter in the middle.
The ones that start with =
are formally called macros, the rest are called metas. See https://github.com/openstenoproject/plover/wiki/Dictionary-Format.
=retrospective_delete_space
is a macro and you can't invoke more than one macro/the macro and some text in one stroke. {*!}
is just the "backwards compatible" name.
So this is actually a feature request for allowing a stroke to trigger a macro and something else.
If you don't need the functionality of the macro, you can look for a meta (*) that does the same thing.
*: may be in a plugin?
A meta that does the same thing is {}{:retro_stringop:5:__import__('re').sub(r"\s+(\S+)\s*$", lambda match: match[1][0].upper()+match[1][1:], text)}
.
(this probably can be done without the retro_stringop plugin, but use retro_stringop for everything is convenient.)
I originally intend to write some plugin to make regex substitution, but I don't see it adds much value (and it would not support change case/some other transformation like the example above)
There also seems to be something going on with them being in the same definition: if I do them as separate strokes
{*!}
followed by{*-|}
does what I'd expect: it turns "now you can" into "now Youcan". But the other way around (doing the capitalization first) turns "now you can" into "now you Can" instead of the expected "now youCan".
This is the part that seems to be broken. I've found myself wanting this when I move to a new window and start writing, and get both a space and a lowercase word. I've starting getting into the habit of deleting the new word, and stroking {^}{-|}
to get the upper case word without space.
Describe the bug
The dictionary translation
{*!}{*-|}
(retroactive capitalize + retroactive remove space) doesn't function as expected. The stroke capitalizes the last word as expected (the{*-|}
part), but does not attach the last word (the{*!}
part). Both the{*!}
and{*-|}
strokes function correctly when used alone, but{*!}
(retroactive remove space) does not function when combined with{*-|}
(retroactive capitalize). This holds no matter the order of the two parts of the translation.To Reproduce
Steps to reproduce the behavior:
{*!}{*-|}
or{*-|}{*!}
(this bug seems to apply to both)Expected behavior
{*!}{*-|}
and{*-|}{*!}
should both attach the previous word and capitalize it.Operating system
Hardware