Skip to content

Commit 46f7b34

Browse files
committed
Sticky source toolbar with filename on file pages
1 parent ecd7ab8 commit 46f7b34

2 files changed

Lines changed: 26 additions & 9 deletions

File tree

gcovr-templates/html/source_page.content.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
{% set uncovered_total = (lines.total - lines.exec) + partial_count %}
1212
<div class="source-container{% if not has_branches %} no-branches{% endif %}">
1313
<div class="source-header">
14+
<span class="source-header-filename">{{filename.split('/')[-1]}}</span>
1415
<div class="source-line-filters">
1516
<button type="button" class="btn btn-sm button_toggle_coveredLine show_coveredLine" value="coveredLine" title="Toggle covered lines">
1617
covered

gcovr-templates/html/style.css

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -876,6 +876,15 @@ body.sidebar-resizing .main-content {
876876
height: var(--header-height);
877877
}
878878

879+
/* On source pages, scroll everything (header, summary) and stick the source toolbar */
880+
.main-content:has(.source-container) {
881+
overflow-y: auto;
882+
}
883+
884+
.main-content:has(.source-container) .main-header {
885+
position: static;
886+
}
887+
879888

880889
.breadcrumb {
881890
display: flex;
@@ -953,11 +962,8 @@ body.sidebar-resizing .main-content {
953962
}
954963

955964
.main-section {
956-
flex: 1;
957-
min-height: 0;
958965
display: flex;
959966
flex-direction: column;
960-
overflow-y: auto;
961967
}
962968

963969
.main-footer {
@@ -1475,11 +1481,8 @@ body.sidebar-resizing .main-content {
14751481
background: var(--bg-secondary);
14761482
border: 1px solid var(--border-color);
14771483
border-radius: var(--radius-lg);
1478-
overflow: clip;
14791484
display: flex;
14801485
flex-direction: column;
1481-
flex: 1;
1482-
min-height: 0;
14831486
}
14841487

14851488
.source-header {
@@ -1491,6 +1494,20 @@ body.sidebar-resizing .main-content {
14911494
flex-wrap: wrap;
14921495
gap: 8px;
14931496
flex-shrink: 0;
1497+
position: sticky;
1498+
top: 0;
1499+
z-index: 20;
1500+
border-radius: var(--radius-lg) var(--radius-lg) 0 0;
1501+
}
1502+
1503+
.source-header-filename {
1504+
font-family: var(--font-mono);
1505+
font-size: var(--font-size-sm);
1506+
font-weight: 600;
1507+
color: var(--text-primary);
1508+
white-space: nowrap;
1509+
overflow: hidden;
1510+
text-overflow: ellipsis;
14941511
}
14951512

14961513
.source-title {
@@ -1774,10 +1791,9 @@ tr.source-line.nav-highlight > td {
17741791
}
17751792

17761793
.source-table-container {
1777-
overflow: auto;
1794+
overflow-x: auto;
17781795
max-width: 100%;
1779-
flex: 1;
1780-
min-height: 0;
1796+
border-radius: 0 0 var(--radius-lg) var(--radius-lg);
17811797
}
17821798

17831799
.source-table {

0 commit comments

Comments
 (0)