This reminds me a bit about the Mozilla Bespin editor from several years ago. They've since merged with the ACE editor, but before the merge they drew everything on a <canvas>. There's some more information about that here: http://benzilla.galbraiths.org/2009/02/17/bespin-and-canvas/