From 56bfc10828d8540d504c67b731f739dae8efc31a Mon Sep 17 00:00:00 2001 From: Griatch Date: Wed, 11 Sep 2019 08:42:34 +0200 Subject: [PATCH] Fix line breaks from fixed-width lines in webclient. Resolve #1837. --- evennia/utils/text2html.py | 9 +++++---- evennia/web/webclient/static/webclient/css/webclient.css | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/evennia/utils/text2html.py b/evennia/utils/text2html.py index fc75780809..e35dc70032 100644 --- a/evennia/utils/text2html.py +++ b/evennia/utils/text2html.py @@ -99,7 +99,8 @@ class TextToHTMLparser(object): re_uline = re.compile("(?:%s)(.*?)(?=%s|%s)" % (underline.replace("[", r"\["), fgstop, bgstop)) re_blink = re.compile("(?:%s)(.*?)(?=%s|%s)" % (blink.replace("[", r"\["), fgstop, bgstop)) re_inverse = re.compile("(?:%s)(.*?)(?=%s|%s)" % (inverse.replace("[", r"\["), fgstop, bgstop)) - re_string = re.compile(r'(?P[<&>])|(?P [ \t]+)|(?P^ )|(?P\r\n|\r|\n)', re.S | re.M | re.I) + re_string = re.compile(r'(?P[<&>])|(?P(?<=\S)\s+)|(?P\s[ \t]+)|' + r'(?P^ )|(?P\r\n|\r|\n)', re.S | re.M | re.I) re_url = re.compile(r'((?:ftp|www|https?)\W+(?:(?!\.(?:\s|$)|&\w+;)[^"\',;$*^\\(){}<>\[\]\s])+)(\.(?:\s|$)|&\w+;|)') re_mxplink = re.compile(r'\|lc(.*?)\|lt(.*?)\|le', re.DOTALL) @@ -291,11 +292,11 @@ class TextToHTMLparser(object): cdict = match.groupdict() if cdict['htmlchars']: return cgi.escape(cdict['htmlchars']) - if cdict['lineend']: + elif cdict['lineend']: return '
' elif cdict['space'] == '\t': return ' ' * self.tabstop - elif cdict['space'] or cdict["spacestart"]: + elif cdict['space'] or cdict["spacestart"] or cdict['firstspace']: text = match.group().replace('\t', ' ' * self.tabstop) text = text.replace(' ', ' ') return text @@ -328,7 +329,7 @@ class TextToHTMLparser(object): result = self.remove_backspaces(result) result = self.convert_urls(result) # clean out eventual ansi that was missed - #result = parse_ansi(result, strip_ansi=True) + # result = parse_ansi(result, strip_ansi=True) return result diff --git a/evennia/web/webclient/static/webclient/css/webclient.css b/evennia/web/webclient/static/webclient/css/webclient.css index fe15af45f1..312f321595 100644 --- a/evennia/web/webclient/static/webclient/css/webclient.css +++ b/evennia/web/webclient/static/webclient/css/webclient.css @@ -17,7 +17,7 @@ body { color: #ccc; font-size: .9em; font-family: 'DejaVu Sans Mono', Consolas, Inconsolata, 'Lucida Console', monospace; - line-height: 1.1em; + line-height: 1.4em; overflow: hidden; } @media screen and (max-width: 480px) {