diff --git a/src/EditProfileDialog.h b/src/EditProfileDialog.h --- a/src/EditProfileDialog.h +++ b/src/EditProfileDialog.h @@ -192,6 +192,7 @@ void lineSpacingChanged(int); void toggleBlinkingCursor(bool); void updateUrlHintsModifier(bool); + void toggleReverseUrlHints(bool); void setCursorShape(int); void autoCursorColor(); diff --git a/src/EditProfileDialog.cpp b/src/EditProfileDialog.cpp --- a/src/EditProfileDialog.cpp +++ b/src/EditProfileDialog.cpp @@ -1429,6 +1429,10 @@ { _ui->enableBidiRenderingButton, Profile::BidiRenderingEnabled, SLOT(togglebidiRendering(bool)) + }, + { + _ui->enableReverseUrlHints, Profile::ReverseUrlHints, + SLOT(toggleReverseUrlHints(bool)) } }; setupCheckBoxes(options, profile); @@ -1612,6 +1616,11 @@ updateTempProfileProperty(Profile::UrlHintsModifiers, int(modifiers)); } +void EditProfileDialog::toggleReverseUrlHints(bool enable) +{ + updateTempProfileProperty(Profile::ReverseUrlHints, enable); +} + void EditProfileDialog::toggleBlinkingText(bool enable) { updateTempProfileProperty(Profile::BlinkingTextEnabled, enable); diff --git a/src/EditProfileDialog.ui b/src/EditProfileDialog.ui --- a/src/EditProfileDialog.ui +++ b/src/EditProfileDialog.ui @@ -1234,6 +1234,16 @@ + + + + Number URL hints in reverse, starting from the bottom + + + Reverse URL hint numbering + + + diff --git a/src/Profile.h b/src/Profile.h --- a/src/Profile.h +++ b/src/Profile.h @@ -288,7 +288,9 @@ */ AlternateScrolling, /** (int) Keyboard modifiers to show URL hints */ - UrlHintsModifiers + UrlHintsModifiers, + /** (bool) Reverse the order of URL hints */ + ReverseUrlHints }; /** diff --git a/src/Profile.cpp b/src/Profile.cpp --- a/src/Profile.cpp +++ b/src/Profile.cpp @@ -94,6 +94,7 @@ // Terminal Features , { UrlHintsModifiers , "UrlHintsModifiers" , TERMINAL_GROUP , QVariant::Int } + , { ReverseUrlHints , "ReverseUrlHints" , TERMINAL_GROUP , QVariant::Bool } , { BlinkingTextEnabled , "BlinkingTextEnabled" , TERMINAL_GROUP , QVariant::Bool } , { FlowControlEnabled , "FlowControlEnabled" , TERMINAL_GROUP , QVariant::Bool } , { BidiRenderingEnabled , "BidiRenderingEnabled" , TERMINAL_GROUP , QVariant::Bool } @@ -186,6 +187,7 @@ setProperty(FlowControlEnabled, true); setProperty(UrlHintsModifiers, 0); + setProperty(ReverseUrlHints, false); setProperty(BlinkingTextEnabled, true); setProperty(UnderlineLinksEnabled, true); setProperty(UnderlineFilesEnabled, false); diff --git a/src/TerminalDisplay.h b/src/TerminalDisplay.h --- a/src/TerminalDisplay.h +++ b/src/TerminalDisplay.h @@ -528,6 +528,16 @@ _urlHintsModifiers = Qt::KeyboardModifiers(modifiers); } + void setReverseUrlHintsEnabled(bool set) + { + _reverseUrlHints = set; + } + + bool isReverseUrlHintsEnabled() const + { + return _reverseUrlHints; + } + /** * Sets the terminal screen section which is displayed in this widget. * When updateImage() is called, the display fetches the latest character image from the @@ -982,6 +992,7 @@ Qt::KeyboardModifiers _urlHintsModifiers; bool _showUrlHint; + bool _reverseUrlHints; bool _openLinksByDirectClick; // Open URL and hosts by single mouse click bool _ctrlRequiredForDrag; // require Ctrl key for drag selected text diff --git a/src/TerminalDisplay.cpp b/src/TerminalDisplay.cpp --- a/src/TerminalDisplay.cpp +++ b/src/TerminalDisplay.cpp @@ -440,6 +440,7 @@ , _hasTextBlinker(false) , _urlHintsModifiers(Qt::NoModifier) , _showUrlHint(false) + , _reverseUrlHints(false) , _openLinksByDirectClick(false) , _ctrlRequiredForDrag(true) , _dropUrlsAsText(false) @@ -1543,10 +1544,17 @@ // iterate over hotspots identified by the display's currently active filters // and draw appropriate visuals to indicate the presence of the hotspot - int urlNumber = 0; QList spots = _filterChain->hotSpots(); + int urlNumber, urlNumInc; + if (_reverseUrlHints) { + urlNumber = spots.size() + 1; + urlNumInc = -1; + } else { + urlNumber = 0; + urlNumInc = 1; + } foreach(Filter::HotSpot* spot, spots) { - urlNumber++; + urlNumber += urlNumInc; QRegion region; if (spot->type() == Filter::HotSpot::Link) { @@ -3564,8 +3572,12 @@ void TerminalDisplay::keyPressEvent(QKeyEvent* event) { if ((_urlHintsModifiers != 0u) && event->modifiers() == _urlHintsModifiers) { + int nHotSpots = _filterChain->hotSpots().count(); int hintSelected = event->key() - 0x31; - if (hintSelected >= 0 && hintSelected < 10 && hintSelected < _filterChain->hotSpots().count()) { + if (hintSelected >= 0 && hintSelected < 10 && hintSelected < nHotSpots) { + if (_reverseUrlHints) { + hintSelected = nHotSpots - hintSelected - 1; + } _filterChain->hotSpots().at(hintSelected)->activate(); _showUrlHint = false; update(); diff --git a/src/ViewManager.cpp b/src/ViewManager.cpp --- a/src/ViewManager.cpp +++ b/src/ViewManager.cpp @@ -820,6 +820,7 @@ view->setTrimTrailingSpaces(profile->property(Profile::TrimTrailingSpacesInSelectedText)); view->setOpenLinksByDirectClick(profile->property(Profile::OpenLinksByDirectClickEnabled)); view->setUrlHintsModifiers(profile->property(Profile::UrlHintsModifiers)); + view->setReverseUrlHintsEnabled(profile->property(Profile::ReverseUrlHints)); view->setMiddleClickPasteMode(Enum::MiddleClickPasteModeEnum(profile->property(Profile::MiddleClickPasteMode))); view->setCopyTextAsHTML(profile->property(Profile::CopyTextAsHTML));