A hint from how the Lisp Machine did quick auto-indent etc: it used doubly linked lines (each line had a link to the one above and below), and each included in its metadata a number for how much it changed the indentation.
Maybe not necessary as fast as machines are today, but I found it pretty neat when I used the idea to make Goldhill Common Lisp's Emacs (an interpreter that ran on original formula IBM-PCs at the time) flash the opening paren that matched the one at the cursor (I think auto-indent was already there, but slow).