calculate_indent_count now takes a string as input rather than a selection