diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-03-27 01:40:56 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-04-01 21:25:20 +0300 |
commit | 08a1867723b5224adafaa61c160b2966c10e0231 (patch) | |
tree | 513b1a6812e616a3e3f484ef1597974b1fc99338 /src/gui/widgets/browserbox.cpp | |
parent | 296894d65a1a8e7d2b9aa0538e3e193b985c207d (diff) | |
download | plus-08a1867723b5224adafaa61c160b2966c10e0231.tar.gz plus-08a1867723b5224adafaa61c160b2966c10e0231.tar.bz2 plus-08a1867723b5224adafaa61c160b2966c10e0231.tar.xz plus-08a1867723b5224adafaa61c160b2966c10e0231.zip |
Fix chat item links. Some times links worked incorrectly.
Diffstat (limited to 'src/gui/widgets/browserbox.cpp')
-rw-r--r-- | src/gui/widgets/browserbox.cpp | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index d5b088369..5ef7adfcd 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -175,13 +175,35 @@ void BrowserBox::addRow(const std::string &row, bool atTop) while (mTextRows.size() > mMaxRows) { mTextRows.pop_front(); - for (unsigned int i = 0; i < mLinks.size(); i++) + + int yStart = 0; + + LinePartIterator i = mLineParts.begin(); + if (i != mLineParts.end()) { - mLinks[i].y1 -= font->getHeight(); - mLinks[i].y2 -= font->getHeight(); + ++ i; + for (; i != mLineParts.end(); ++ i) + { + const LinePart &part = *i; + if (!part.mX) + { + yStart = part.mY; + break; + } + } + } - if (mLinks[i].y1 < 0) - mLinks.erase(mLinks.begin() + i); + LinkIterator it = mLinks.begin(); + LinkIterator it_end = mLinks.end(); + while (it != it_end) + { + (*it).y1 -= yStart; + (*it).y2 -= yStart; + + if ((*it).y1 < 0) + it = mLinks.erase(it); + else + ++ it; } } } |