diff options
Diffstat (limited to 'src/ui/sidebarwidget.c')
-rw-r--r-- | src/ui/sidebarwidget.c | 54 |
1 files changed, 32 insertions, 22 deletions
diff --git a/src/ui/sidebarwidget.c b/src/ui/sidebarwidget.c index da377ac2..73023a4f 100644 --- a/src/ui/sidebarwidget.c +++ b/src/ui/sidebarwidget.c | |||
@@ -2156,28 +2156,38 @@ static void draw_SidebarItem_(const iSidebarItem *d, iPaint *p, iRect itemRect, | |||
2156 | : uiTextDim_ColorId; | 2156 | : uiTextDim_ColorId; |
2157 | iUrl parts; | 2157 | iUrl parts; |
2158 | init_Url(&parts, &d->label); | 2158 | init_Url(&parts, &d->label); |
2159 | const iBool isAbout = equalCase_Rangecc(parts.scheme, "about"); | 2159 | const iBool isAbout = equalCase_Rangecc(parts.scheme, "about"); |
2160 | const iBool isGemini = equalCase_Rangecc(parts.scheme, "gemini"); | 2160 | const iBool isGemini = equalCase_Rangecc(parts.scheme, "gemini"); |
2161 | draw_Text(font, | 2161 | const iBool isData = equalCase_Rangecc(parts.scheme, "data"); |
2162 | add_I2(topLeft_Rect(itemRect), | 2162 | const int queryColor = isPressing ? uiTextPressed_ColorId |
2163 | init_I2(3 * gap_UI, (itemHeight - lineHeight_Text(font)) / 2)), | 2163 | : isHover ? uiText_ColorId |
2164 | fg, | 2164 | : uiAnnotation_ColorId; |
2165 | "%s%s%s%s%s%s%s%s", | 2165 | const iInt2 textPos = |
2166 | isGemini ? "" : cstr_Rangecc(parts.scheme), | 2166 | add_I2(topLeft_Rect(itemRect), |
2167 | isGemini ? "" | 2167 | init_I2(3 * gap_UI, (itemHeight - lineHeight_Text(font)) / 2)); |
2168 | : isAbout ? ":" | 2168 | if (isData) { |
2169 | : "://", | 2169 | drawRange_Text( |
2170 | escape_Color(isHover ? (isPressing ? uiTextPressed_ColorId | 2170 | font, textPos, fg, range_String(prettyDataUrl_String(&d->label, queryColor))); |
2171 | : uiTextFramelessHover_ColorId) | 2171 | } |
2172 | : uiTextStrong_ColorId), | 2172 | else { |
2173 | cstr_Rangecc(parts.host), | 2173 | draw_Text( |
2174 | escape_Color(fg), | 2174 | font, |
2175 | cstr_Rangecc(parts.path), | 2175 | textPos, |
2176 | !isEmpty_Range(&parts.query) ? escape_Color(isPressing ? uiTextPressed_ColorId | 2176 | fg, |
2177 | : isHover ? uiText_ColorId | 2177 | "%s%s%s%s%s%s%s%s", |
2178 | : uiAnnotation_ColorId) | 2178 | isGemini ? "" : cstr_Rangecc(parts.scheme), |
2179 | : "", | 2179 | isGemini ? "" |
2180 | !isEmpty_Range(&parts.query) ? cstr_Rangecc(parts.query) : ""); | 2180 | : isAbout ? ":" |
2181 | : "://", | ||
2182 | escape_Color(isHover ? (isPressing ? uiTextPressed_ColorId | ||
2183 | : uiTextFramelessHover_ColorId) | ||
2184 | : uiTextStrong_ColorId), | ||
2185 | cstr_Rangecc(parts.host), | ||
2186 | escape_Color(fg), | ||
2187 | cstr_Rangecc(parts.path), | ||
2188 | !isEmpty_Range(&parts.query) ? escape_Color(queryColor) : "", | ||
2189 | !isEmpty_Range(&parts.query) ? cstr_Rangecc(parts.query) : ""); | ||
2190 | } | ||
2181 | } | 2191 | } |
2182 | iEndCollect(); | 2192 | iEndCollect(); |
2183 | } | 2193 | } |