fix(prompts): :bug: prompt attention behaviors, add tests by joshistoast · Pull Request #8683 · invoke-ai/InvokeAI

The use case described in the description is working properly. However, I found a case that does not do what I'd expect:

  1. Original prompt: pre (a b c)+ d post
  2. Select two or more words within the parentheses: pre (a b c)+ d post
  3. Hit the upweight key, get: pre (a b c)++ d post. I expected: pre (a (b c)+)+ d post

Maybe the desired behavior is that any up/down-weighting action within a parentheses expands to the entire contents of the parentheses, but then there is a UI inconsistency, because if I select a single word within the parentheses, or even just have the insertion point adjacent to a word, then that single word is weighted:

  1. Original prompt: pre (a b c)+ d post
  2. Select one word within the parentheses: pre (a b c)+ d post
  3. Hit the upweight key, get: pre (a b+ c)+ d post, which is what I expect