From 764b4be6b13fef92c702bdece67a4674a810dafe Mon Sep 17 00:00:00 2001 From: bunnie Date: Mon, 21 Feb 2022 00:03:28 +0800 Subject: [PATCH] clean up status line overrun if text fitting went errant --- services/status/src/main.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/services/status/src/main.rs b/services/status/src/main.rs index 0203e1b4a..03ccf0e48 100644 --- a/services/status/src/main.rs +++ b/services/status/src/main.rs @@ -449,8 +449,8 @@ fn xmain() -> ! { if (debug_locked != is_locked) || force_update || secnotes_force_redraw || sec_notes.lock().unwrap().len() != last_sec_note_size - || (sec_notes.lock().unwrap().len() > 1) - && ((stats_phase % secnotes_interval) == 0) + || /*(sec_notes.lock().unwrap().len() > 1) // force the redraw periodically to clean up any tb overflow from uptime + &&*/ ((stats_phase % secnotes_interval) == 0) { log::debug!("updating lock state text"); if debug_locked != is_locked { @@ -576,6 +576,14 @@ fn xmain() -> ! { .expect("|status: can't write string"); gam.post_textview(&mut uptime_tv) .expect("|status: can't draw uptime"); + if let Some(bounds) = uptime_tv.bounds_computed { + if bounds.height() as i16 > screensize.y / 2 + 1 { + // the clipping rectangle limits the bounds to the overall height of the status area, so + // the overlap between status and secnotes must be managed within this server + log::info!("Status text overstepped its intended bound. Forcing secnotes redraw."); + secnotes_force_redraw = true; + } + } } log::trace!("status redraw## update"); gam.redraw().expect("|status: couldn't redraw");