Thanks for posting this! I decided to improve the line numbering implementation in Taco HTML Edit, and this solution seems to work perfectly.