Reworked the text file preview system to avoid UI freezes with large text files