From 87cc5427814765418c074349e6e40b73349eb863 Mon Sep 17 00:00:00 2001 From: Trygve Aaberge Date: Tue, 1 Aug 2017 17:23:07 +0200 Subject: Prevent lines being broken in bare display mode If you update a line with hdata_update and pass a string containing newlines, the buffer will become a bit broken when bare display mode is activated (alt+l). It seems that the newlines are printed in bare mode, but extra lines are not inserted, so the lines are overlapping with each other. Fixes #306 --- wee_slack.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wee_slack.py b/wee_slack.py index dd8a00d..7bfa4a9 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -2742,6 +2742,9 @@ def modify_buffer_line(buffer, new_line, timestamp, time_id): # split the message into at most the number of existing lines lines = new_line.split('\n', number_of_matching_lines - 1) + # updating a line with a string containing newlines causes the lines to + # be broken when viewed in bare display mode + lines = [line.replace('\n', ' | ') for line in lines] # pad the list with empty strings until the number of elements equals # number_of_matching_lines lines += [''] * (number_of_matching_lines - len(lines)) -- cgit