From 166ff3b2e30af5d07210c0af21a8502e283f2ee8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Tue, 21 Aug 2018 12:33:08 +0200 Subject: [PATCH] colors: Replace multiple newlines with a single one. --- matrix/colors.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/matrix/colors.py b/matrix/colors.py index e1a6eba..85cbe24 100644 --- a/matrix/colors.py +++ b/matrix/colors.py @@ -24,6 +24,7 @@ from collections import namedtuple from matrix.globals import W, OPTIONS from matrix.utils import string_strikethrough +import re import textwrap import webcolors @@ -322,7 +323,7 @@ class Formatted(): return text weechat_strings = map(format_string, self.substrings) - return "".join(weechat_strings).replace("\n\n", "\n").strip() + return re.sub(r'\n+', '\n', "".join(weechat_strings)).strip() # TODO this should be a typed dict.