Be more careful when stripping newline added by pygments.

Calls rstrip() instead of cutting of the last character blindly, so
that:

1. Potentially multiple trailing whitespace of any kind will get
   stripped.
2. We don't chop off a non-whitespace character, in case pygments'
   changes.
This commit is contained in:
Denis Kasak 2018-11-12 19:31:24 +01:00 committed by Damir Jelić
parent 96e8f5246b
commit 041c15e811

View file

@ -313,7 +313,7 @@ class Formatted(object):
# highlight adds a newline to the end of the string, remove it
# from the output
return highlight(string, lexer,
WeechatFormatter(style=style))[:-1]
WeechatFormatter(style=style)).rstrip()
elif name == "fgcolor":
return "{color_on}{text}{color_off}".format(
color_on=W.color(value),