Optimized line count calculation for dynamic words when text is deleted.