aboutsummaryrefslogtreecommitdiffstats
path: root/wee_slack.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2017-08-01 17:23:07 +0200
committerTrygve Aaberge <trygveaa@gmail.com>2017-08-12 22:31:31 +0200
commit87cc5427814765418c074349e6e40b73349eb863 (patch)
tree3d33f8b9afcb29436f9dd7b28c23d10cbc75de6d /wee_slack.py
parentd2531a9bf46c18fab76d8f9029263b3d3ebbe30b (diff)
downloadwee-slack-87cc5427814765418c074349e6e40b73349eb863.tar.gz
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
Diffstat (limited to 'wee_slack.py')
-rw-r--r--wee_slack.py3
1 files changed, 3 insertions, 0 deletions
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))