Fix for #293. Cut off long lines (> 5000)

 so that UI remains somewhat responsive.