Added some guards against pathological cases in the generic algorithm.
Added some guards against pathological cases in the generic algorithm.

busykai/brackets-indent-right,veveykocute/brackets-indent-right