Apply a token before next stream?

I’m writing a mode and would like to apply a token if a line is all in uppercase. That’s simple enough. But I’m wondering if it’s possible to apply the token only after the end of line.

So if a user is typing I don’t want the token applied until they hit enter.

Thanks!

No, that’s not how modes work – they don’t know anything about where the cursor is or what the user is doing, they just color a stream of text. But you could write an addon that listens to cursorActivity events and calls markText when the cursor moves away from an uppercase line.