Skip to content

Why is my Python dictionary looked up more than once for every new stroke? #1338

Discussion options

You must be logged in to vote

Generally, you can't rely on the Python plugin is only looked up once every stroke. If the lookup function has side effects, it's better to make an extension plugin and use the stroked engine hook.

Internally, for every stroke, the translator does the following...

  • Lookup the last stroke to see if it translates to a macro.
  • If it isn't, consider the last (longest_key), longest_key-1, longest_key-2, ..., 3, 2, 1 strokes, for each of them...
    • Lookup the outline.
    • Iterate over the suffix keys, if it's in the last stroke...
      • Lookup the suffix key in the dictionary
      • Lookup the remaining (with the suffix key removed) in the dictionary

Replies: 1 comment

Comment options

user202729
May 26, 2021
Collaborator Author

You must be logged in to vote
0 replies
Answer selected by user202729
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant