I think by giving the text box an additional attribute that somehow identifies it with its parent post.
This feature is present in some forum software (Discourse, phpBB, XenForo, vBulletin), as far as I can remember (certain about Discourse).
Edit: Non-urgent, obviously. But good for convenience.
(post is archived)