Avoid overriding style if there are no ANSI codes

This resolves an issue wherein no ranges were identified but the `if (lastRangeEnd != currentText.length())` block was still executed, overriding the style of the line.