Skip to content

Commit a8975a0

Browse files
committed
fix rapid resize crash
1 parent e4c41a2 commit a8975a0

1 file changed

Lines changed: 16 additions & 3 deletions

File tree

src/redfetch/terminal_ui.tcss

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,9 @@ Label {
115115

116116
#fetch_log_container {
117117
layout: grid;
118-
grid-rows: auto 1fr;
118+
/* Fixed 1-line toolbar row.
119+
Avoids Rich/Textual measuring content with a wrap width of 0 during rapid resizes. */
120+
grid-rows: 1 1fr;
119121
grid-gutter: 0;
120122
min-height: 10;
121123
}
@@ -124,8 +126,11 @@ Label {
124126
layout: grid;
125127
background: $secondary-background-darken-2;
126128
grid-size: 5;
127-
grid-columns: 6fr 1fr 1fr 4fr 4fr;
128-
grid-rows: auto;
129+
/* The prev/next buttons can end up 2-cells wide with fractional columns.
130+
Rich will raise `ValueError: range() arg 3 must not be zero` if it is asked to wrap at width 0.
131+
Give them fixed widths and a fixed row height to keep content-measurement safe during resizes. */
132+
grid-columns: 6fr 3 3 4fr 4fr;
133+
grid-rows: 1;
129134
}
130135

131136
#copy_log, #clear_log, #log_search {
@@ -144,6 +149,14 @@ Label {
144149
color: $text-muted;
145150
background: $secondary-background-darken-1 39%;
146151
border: none;
152+
text-wrap: nowrap;
153+
text-overflow: clip;
154+
content-align: center middle;
155+
}
156+
157+
#copy_log, #clear_log {
158+
text-wrap: nowrap;
159+
text-overflow: ellipsis;
147160
}
148161

149162
#fetch_log {

0 commit comments

Comments
 (0)