c0dfb42

Pinchord · pinchord.git · Tickets · Changelog

Branches > pre-release-31-3 > c0dfb42 > files / setup.cfg

Avoid adorning macros with affix translations

Grahp, 2026-10-24

Commit: c0dfb42c95d272b14cf9abad63b2ac1cea56933e
Parent: 2ad09cb

1 changed file:

plover_pinchord_31/extension.py modified (view file)

@@ -1,4 +1,5 @@ ## Makes the affix keys work on every entry, even user-defined ones+import re from plover import system from plover.steno import Stroke @@ -12,11 +13,16 @@             ("-s",): "{^}s",             ("-e", "-s"): "{^}es"} +# Macros don't work with translations like {} (only =undo works, not {}=undo)+MACRO = r"=\w+(:.*)?|\{\*[!?+]?\}"+ # Wraps the given translation in its affix translations # e.g. with_affixes(Stroke("#"), "test", Stroke("-s")) -> "{}{-|}test{^}s" def with_affixes(prefixes, translation, suffixes):   if translation is None:     return None+  elif re.fullmatch(MACRO, translation):+    return None if prefixes or suffixes else translation   else:     return PREFIXES[prefixes.keys()] + translation + SUFFIXES[suffixes.keys()]