Fixed bug in getLineCounts. Checks selection from text