Fix an error with line segmentation
Fix calculation of tab positions
Fix cursor positioning in fields with tabs
Fix alignment for single-segment lines