From acc395f67dbe683787f1aeb0bf96fe0a16f62c5e Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 14 Jun 2017 19:04:58 +0300 Subject: Add workaround to browserbox if text line start with bold sign. This fix only most used cases. --- src/gui/widgets/browserbox.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index 22a6cec9d..2d9202805 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -307,6 +307,10 @@ void BrowserBox::addRow(const std::string &row, const bool atTop) if (mMode == BrowserBoxMode::AUTO_SIZE) { std::string plain = newRow; + // workaround if used only one string started from bold + // width for this string can be calculated wrong + // this workaround fix width if string start from bold sign + const bool startBold = (plain.find("##B") == 0); for (idx1 = plain.find("##"); idx1 != std::string::npos; idx1 = plain.find("##")) @@ -315,7 +319,8 @@ void BrowserBox::addRow(const std::string &row, const bool atTop) } // Adjust the BrowserBox size - const int w = font->getWidth(plain); + const int w = startBold ? + boldFont->getWidth(plain) : font->getWidth(plain); if (w > getWidth()) setWidth(w); } -- cgit v1.2.3-60-g2f50