Skip to content

Conversation

@greenstrand
Copy link

@greenstrand greenstrand commented Dec 16, 2025

  • Please check if the pull request fulfills these requirements
  • Tests for the changes have been added (for bug fixes / features)
    • Does it pass all existing unit tests without modification?
      • If not, what did you change?
      • If you altered it significantly, what coverage issue did you fix?
  • Docs have been added / updated (for bug fixes / features)
  • CHANGELOG.md has been updated to describe this change
  • What kind of change does this pull request introduce?
  • Bug Fix
  • Feature
  • Something else
  • What is the current behavior?
    Currently, typewriters will notify all action markup handlers when each character is shown and await any tasks returned by IActionMarkupHandler.OnCharacterWillAppear. This lets us write custom markup handlers that respond to tags to pause in the middle of a line, run an animation, or await some other signal. However, when a line has been fully displayed, typewriters call IActionMarkupHandler.OnLineDisplayComplete which is synchronous, so ActionMarkupHandlers cannot pause execution without hanging the main event thread.

  • What is the new behavior (if this is a feature change)?

This changes the interface for IActionMarkupHandler.OnLineDisplayComplete so that it accepts a cancellation token and returns a YarnTask, allowing it to pause dialogue execution at the end of the line.

Existing implementations of IActionMarkupHandler have been updated with the new signature, simply returning YarnTask.CompletedTask. The three implementations of IAsyncTypewriter all await on tasks from all registered action markup handlers at the completion of the line.

  • Does this pull request introduce a breaking change?

This introduces a breaking change for any classes that implement IActionMarkupHandler, as they must modify the signature and return value of OnLineDisplayComplete or make it async. Any classes that call IActionMarkupHandler should also await OnLineDisplayComplete in the same manner that they were already awaiting OnCharacterWillAppear.

This should not otherwise change any actual behavior; existing implementations can simply return YarnTask.CompletedTask or become async, and behavior should be the same.

  • Other information:

This is my first proposed PR for you all! I'm not positive how the tests get run, so I'm hoping they get run for this PR. As this could be annoying for downstream implementations of IActionMarkupHandler, I definitely won't be offended if y'all this this is too much trouble for too little gain. I also don't see any tests at all related to IActionMarkupHandler so if you want to point me in the right direction I'd be happy to add some for this change.

@CLAassistant
Copy link

CLAassistant commented Dec 16, 2025

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants