index: refactor to use a manual implementation

Surprisingly, the manual implementation is *a lot* less code
than what it took to *correct* the native `indent` command cross-browser.