a1111-sd-webui-tagcomplete icon indicating copy to clipboard operation
a1111-sd-webui-tagcomplete copied to clipboard

Solve know issues

Open sgmklp opened this issue 2 years ago • 3 comments

The new function will find the word from the last comma in front of the cursor (or the beginning of the text) to the cursor position as the keyword, and will use the word from the last comma in front of the cursor position to the first comma behind the cursor (or the end of the text) as the editing area. Therefore, it solves the know issues. And when the user enters a space, Tagword will not be reset.

sgmklp avatar Oct 20 '22 02:10 sgmklp

In addition, I hope to delete the binding events of ArrowLeft and ArrowLeft, so that it can adjust the cursor position at any time (especially when the result list is displayed). What do you think about this?

sgmklp avatar Oct 20 '22 03:10 sgmklp

And it will not add a comma after the tag. Because the selected styles to current prompt function of WebUI will add a comma before inserting text, we should keep the end without a comma to avoid repetition.

sgmklp avatar Oct 20 '22 03:10 sgmklp

Thanks for the suggestion, but I don't think this is the better way. While it resolves some issues like spaces cancelling the edit, it also creates many more that are breaking core functionality:

  1. It depends on commas, so adding a new tag without first separating it from the previous with a comma will not work. Currently you can edit any word of the prompt and it will try to find a matching tag, without needing to worry about punctuation.
  2. If you have a longer section without commas, it will replace the whole thing if you edit a tag at the beginning
    • Example: highres, solo long hair dress white flower. If you edit "solo" and complete it to e.g. "solo_focus", the whole end will also be replaced. Since this has potential to delete a whole part of the prompt and you can't undo the programmatic replacement with CTRL-Z in most browsers, it is destructive and too risky.
  3. No automatic commas makes it slower to add many tags in a row. The apply selected styles to current prompt only inserts a comma at the end, or surrounding the {prompt} placeholder feature. So you will only have to delete the comma after the last tag to not get duplicates, which is way faster than adding new ones after every tag manually.

I consider the problem with spaces pretty minor in comparison, with this method it is much slower and more annoying to use in my opinion.

In addition, I hope to delete the binding events of ArrowLeft and ArrowLeft, so that it can adjust the cursor position at any time (especially when the result list is displayed). What do you think about this?

Originally these were a workaround for a bug with text insertion which I fixed later, but they also still have the use of jumping to the very start/end of the list, which is useful for long result lists. I would definitely like to keep that functionality. At the moment, pressing ESC to close the window or using the mouse cursor is a workaround, and we could also add a config option for it if you think it is important to have. But I don't want to remove or deactivate it by default.

DominikDoom avatar Oct 20 '22 12:10 DominikDoom

Since the script changed a lot since this was first opened, it's been incompatible for a while now. Especially with the newer syntaxes that were introduced to support other types of completion. I also think the fixes here aren't needed anymore for most cases, so I'll close it for now.

DominikDoom avatar Jan 24 '23 14:01 DominikDoom