From cc44eaf93584f0418eecc56fb1b9e92a26a47efe Mon Sep 17 00:00:00 2001 From: Nimetu Date: Sun, 25 Apr 2021 11:05:07 +0300 Subject: [PATCH] Ignore first linebreak after pre, textarea open tag --- nel/src/gui/html_parser.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/nel/src/gui/html_parser.cpp b/nel/src/gui/html_parser.cpp index bcb83bf8e..80725552e 100644 --- a/nel/src/gui/html_parser.cpp +++ b/nel/src/gui/html_parser.cpp @@ -66,7 +66,15 @@ namespace NLGUI { if (node->type == XML_TEXT_NODE) { - parent.Children.push_back(CHtmlElement(CHtmlElement::TEXT_NODE, (const char*)(node->content))); + // linebreak right after pre,textare open tag should be removed + if (parent.Children.empty() && (*node->content == '\n') && (parent.ID == HTML_PRE || parent.ID == HTML_TEXTAREA)) + { + parent.Children.push_back(CHtmlElement(CHtmlElement::TEXT_NODE, (const char*)(node->content) + 1)); + } + else + { + parent.Children.push_back(CHtmlElement(CHtmlElement::TEXT_NODE, (const char*)(node->content))); + } } else if (node->type == XML_ELEMENT_NODE) -- 2.11.4.GIT