[PATCH 3 of 3] monoblue: visually highlight source lines when hovering over line numbers
Anton Shestakov
av6 at dwimlabs.net
Wed Oct 14 09:50:52 CDT 2015
# HG changeset patch
# User Anton Shestakov <av6 at dwimlabs.net>
# Date 1444833951 -28800
# Wed Oct 14 22:45:51 2015 +0800
# Node ID 1152c34aabc1cfc54275e0c90f38b2f4afd01e06
# Parent a96340631f8caa63ebde31f2666da75fcea0838e
monoblue: visually highlight source lines when hovering over line numbers
Due to how the line links now reside outside of the source lines, hovering over
line numbers doesn't count as hovering over the appropriate source line. It can
be worked around by using a "+" css selector. However, it's necessary to
reorder the elements and put <a> before <span> (which is actually quite
logical). It works without further css tweaks because <a> is already
absolute-positioned and so the order doesn't matter visually.
diff --git a/mercurial/templates/monoblue/map b/mercurial/templates/monoblue/map
--- a/mercurial/templates/monoblue/map
+++ b/mercurial/templates/monoblue/map
@@ -89,7 +89,7 @@ filediff = filediff.tmpl
filecomparison = filecomparison.tmpl
filelog = filelog.tmpl
fileline = '
- <span id="{lineid}">{strip(line|escape, '\r\n')}</span><a href="#{lineid}"></a>'
+ <a href="#{lineid}"></a><span id="{lineid}">{strip(line|escape, '\r\n')}</span>'
annotateline = '
<tr id="{lineid}" class="parity{parity}">
<td class="linenr">
@@ -102,13 +102,13 @@ annotateline = '
<td class="source">{line|escape}</td>
</tr>'
difflineplus = '
- <span id="{lineid}" class="difflineplus">{strip(line|escape, '\r\n')}</span><a href="#{lineid}"></a>'
+ <a href="#{lineid}"></a><span id="{lineid}" class="difflineplus">{strip(line|escape, '\r\n')}</span>'
difflineminus = '
- <span id="{lineid}" class="difflineminus">{strip(line|escape, '\r\n')}</span><a href="#{lineid}"></a>'
+ <a href="#{lineid}"></a><span id="{lineid}" class="difflineminus">{strip(line|escape, '\r\n')}</span>'
difflineat = '
- <span id="{lineid}" class="difflineat">{strip(line|escape, '\r\n')}</span><a href="#{lineid}"></a>'
+ <a href="#{lineid}"></a><span id="{lineid}" class="difflineat">{strip(line|escape, '\r\n')}</span>'
diffline = '
- <span id="{lineid}">{strip(line|escape, '\r\n')}</span><a href="#{lineid}"></a>'
+ <a href="#{lineid}"></a><span id="{lineid}">{strip(line|escape, '\r\n')}</span>'
comparisonblock ='
<tbody class="block">
diff --git a/mercurial/templates/static/style-monoblue.css b/mercurial/templates/static/style-monoblue.css
--- a/mercurial/templates/static/style-monoblue.css
+++ b/mercurial/templates/static/style-monoblue.css
@@ -300,11 +300,13 @@ pre.sourcelines > a {
height: 1em;
padding: 0.15em;
}
-pre.sourcelines.stripes > :nth-child(4n+1) { background-color: #F1F6F7; }
-pre.sourcelines.stripes > :nth-child(4n+3) { background-color: #FFFFFF; }
-pre.sourcelines.stripes > :nth-child(4n+1):hover,
-pre.sourcelines.stripes > :nth-child(4n+3):hover { background-color: #D5E1E6; }
-tr:target td,
+pre.sourcelines.stripes > :nth-child(4n+2) { background-color: #F1F6F7; }
+pre.sourcelines.stripes > :nth-child(4n+4) { background-color: #FFFFFF; }
+pre.sourcelines.stripes > :nth-child(4n+2):hover,
+pre.sourcelines.stripes > :nth-child(4n+4):hover,
+pre.sourcelines.stripes > :nth-child(4n+1):hover + :nth-child(4n+2),
+pre.sourcelines.stripes > :nth-child(4n+3):hover + :nth-child(4n+4) { background-color: #D5E1E6; }
+
pre.sourcelines > span:target,
pre.sourcelines.stripes > span:target {
background-color: #bfdfff;
More information about the Mercurial-devel
mailing list