fixed truncate function so preview text had the right length before ellipses