From 7fc90d3dce9e88ee858d0991f0a82438d79d2386 Mon Sep 17 00:00:00 2001 From: Lirusaito Date: Thu, 11 Apr 2019 03:47:49 -0400 Subject: [PATCH] Feature Request: Add SinguAlwaysUnderlineLinks to always underline links --- indra/llui/lltexteditor.cpp | 13 ++++++++++--- indra/newview/app_settings/settings_ascent.xml | 11 +++++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index e2e34538b..1b0501973 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -1592,6 +1592,11 @@ BOOL LLTextEditor::handleMiddleMouseDown(S32 x, S32 y, MASK mask) return TRUE; } +bool always_underline_links() +{ + static const LLUICachedControl always_underline("SinguAlwaysUnderlineLinks"); + return always_underline; +} BOOL LLTextEditor::handleHover(S32 x, S32 y, MASK mask) { @@ -1684,7 +1689,7 @@ BOOL LLTextEditor::handleHover(S32 x, S32 y, MASK mask) if (old_hover != mHoverSegment) { - if (old_hover) + if (old_hover && !always_underline_links()) old_hover->underlineOnHover(false); if (mHoverSegment) mHoverSegment->underlineOnHover(true); @@ -1699,7 +1704,7 @@ BOOL LLTextEditor::handleHover(S32 x, S32 y, MASK mask) void LLTextEditor::onMouseLeave(S32 x, S32 y, MASK mask) { - if (mHoverSegment) + if (mHoverSegment && !always_underline_links()) { mHoverSegment->underlineOnHover(false); mHoverSegment = nullptr; @@ -4308,7 +4313,9 @@ void LLTextEditor::appendTextImpl(const std::string &new_text, const LLStyleSP s } // Hack around colors looking bad on some backgrounds by allowing setting link color for this editor if (mLinkColor) link_style->setColor(*mLinkColor); - appendAndHighlightText(link, part, link_style, true/*match.underlineOnHoverOnly()*/); + const auto always_underline(always_underline_links()); + if (always_underline) link_style->mUnderline = true; + appendAndHighlightText(link, part, link_style, !always_underline/*match.underlineOnHoverOnly()*/); }; const auto&& cb = force_replace_links ? boost::bind(&LLTextEditor::replaceUrl, this, _1, _2, _3) : LLUrlLabelCallback::slot_function_type(); while (!text.empty() && LLUrlRegistry::instance().findUrl(text, match, cb)) diff --git a/indra/newview/app_settings/settings_ascent.xml b/indra/newview/app_settings/settings_ascent.xml index ff2f40154..5c2f1ea63 100644 --- a/indra/newview/app_settings/settings_ascent.xml +++ b/indra/newview/app_settings/settings_ascent.xml @@ -1131,6 +1131,17 @@ Changing this setting only affects new text. Value 0 + SinguAlwaysUnderlineLinks + + Comment + Enable to always underline new links in text editors (and any you hover over after enabling this) + Persist + 1 + Type + Boolean + Value + 0 + SingularitySplashPagePrefix Comment