When editing the attached mako example as indicated in the file, lexing gets confused. I can't seem to figure this one out so am just posting it as a bug for now. I suspect it has to do with wrong line state set for line 3 in the file since it works if the tag is all on one line. Re-lexing the whole file works; it is just starting in the middle during the edit that fails. I tested this within Wing IDE and don't know if it'll act quite the same way in another Scintilla integration.