fix(admin): field label/value overlap and scrollbar-clipped freq digit

Long field labels ("Flood advert interval (h)", "Frequency (MHz)") were
ellipsized to nearly the full row width with no reserve for the value
column, so a label could run under/through the value or digit editor on
the row currently being edited. Only rows showing an inline value now
reserve room before valCol(); other rows keep the full width as before.

Separately, the Frequency digit editor (4 int + 3 dec digits, needed for
Admin's wider 150-2500 MHz range vs Repeater's 3-digit range) drew all 8
digits flush to the screen edge, landing the thousandths digit exactly
under a visible scrollbar's reserve column. Shifted left by that reserve,
matching the plain-value branch's existing scrollbar-aware positioning.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Jakub
2026-07-17 20:27:55 +02:00
parent 453dc5e570
commit ce1fde4fdb

View File

@@ -447,10 +447,21 @@ public:
drawList(display, n, _row_sel, _row_scroll, [&](int i, int y, bool sel, int reserve) { drawList(display, n, _row_sel, _row_scroll, [&](int i, int y, bool sel, int reserve) {
drawRowSelection(display, y, sel, reserve); drawRowSelection(display, y, sel, reserve);
const AdminField& f = fieldAt(_tab, i); const AdminField& f = fieldAt(_tab, i);
display.drawTextEllipsized(2, y, display.width() - 4 - reserve, f.label); bool show_val = _value_editing && sel; // the row whose typed editor is currently open
if (_value_editing && sel) { // the row whose typed editor is currently open // Leave room for the value column on the row currently showing one, so a
// long label (e.g. "Flood advert interval (h)") can't run under/through
// the value being edited -- only rows without an inline value get the
// full row width.
int label_max = show_val ? display.valCol() - 4 : display.width() - 4 - reserve;
display.drawTextEllipsized(2, y, label_max, f.label);
if (show_val) {
if (f.kind == FK_RADIO_FREQ) { if (f.kind == FK_RADIO_FREQ) {
_freq_ed.render(display, display.valCol(), y); // valCol() reserves exactly the 8-char width this editor draws (4
// int + '.' + 3 dec), so with no margin to spare, a visible
// scrollbar's reserve column would otherwise swallow the last
// (thousandths) digit -- shift left to stay clear of it, same as
// the plain-value branch below.
_freq_ed.render(display, display.valCol() - reserve, y);
} else { } else {
char val[16]; char val[16];
formatEditValue(val, sizeof(val)); formatEditValue(val, sizeof(val));