truncate display of long messages to avoid freezing the UI