Commit 28e1a3e6 authored by Tomaz  Canabrava's avatar Tomaz Canabrava

Correctly fix reverse url numering

parent cf2c8a03
......@@ -249,15 +249,12 @@ void FilterChain::paint(TerminalDisplay* td, QPainter& painter)
const auto spots = hotSpots();
int urlNumber;
int urlNumInc;
// TODO: Remove _reverseUrllHints from TerminalDisplay.
if (_reverseUrlHints) { // TODO: Access reverseUrlHints from the profile, here.
urlNumber = count(HotSpot::Link);
urlNumInc = -1;
} else {
urlNumber = 0;
urlNumInc = 1;
}
for (const auto &spot : spots) {
......@@ -267,9 +264,12 @@ void FilterChain::paint(TerminalDisplay* td, QPainter& painter)
region = spotRegion.first;
QRect r = spotRegion.second;
// TODO: Move this paint code to HotSpot->drawHint();
// TODO: Fix the Url Hints access from the Profile.
if (_showUrlHint && spot->type() == HotSpot::Link) {
// if we are in reverse url hints mode, we need to get the proper number,
// before trying to display the hint. if we don't do that we miss mint nr. '0'.
if (_reverseUrlHints) {
urlNumber -= 1;
}
if (urlNumber >= 0 && urlNumber < 10) {
// Position at the beginning of the URL
QRect hintRect(*region.begin());
......@@ -279,7 +279,10 @@ void FilterChain::paint(TerminalDisplay* td, QPainter& painter)
painter.drawRect(hintRect.adjusted(0, 0, -1, -1));
painter.drawText(hintRect, Qt::AlignCenter, QString::number(urlNumber));
}
urlNumber += urlNumInc;
// But if we are not in reverse mode, we need to increase it later.
if (!_reverseUrlHints) {
urlNumber += 1;
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment