Properly handle newlines in quote blocks
This commit is contained in:
parent
b4a3aabad9
commit
0ce5b65835
1 changed files with 7 additions and 3 deletions
|
@ -356,11 +356,15 @@ class Formatted(object):
|
||||||
quote_pair = color_pair(G.CONFIG.color.quote_fg,
|
quote_pair = color_pair(G.CONFIG.color.quote_fg,
|
||||||
G.CONFIG.color.quote_bg)
|
G.CONFIG.color.quote_bg)
|
||||||
|
|
||||||
|
# Remove leading and trailing newlines; Riot sends an extra
|
||||||
|
# quoted "\n" when a user quotes a message.
|
||||||
|
string = string.strip("\n")
|
||||||
|
if len(string) == 0:
|
||||||
|
return string
|
||||||
|
|
||||||
if G.CONFIG.look.quote_wrap >= 0:
|
if G.CONFIG.look.quote_wrap >= 0:
|
||||||
wrapper = self.textwrapper(G.CONFIG.look.quote_wrap, quote_pair)
|
wrapper = self.textwrapper(G.CONFIG.look.quote_wrap, quote_pair)
|
||||||
return wrapper.fill(
|
return wrapper.fill(W.string_remove_color(string, ""))
|
||||||
W.string_remove_color(string.replace("\n", ""), "")
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
# Don't wrap, just add quote markers to all lines
|
# Don't wrap, just add quote markers to all lines
|
||||||
return "{color_on}{text}{color_off}".format(
|
return "{color_on}{text}{color_off}".format(
|
||||||
|
|
Loading…
Reference in a new issue