From ebf0a02345cc2ad30f46bf508d28f689b3e65ab2 Mon Sep 17 00:00:00 2001 From: bunnie Date: Tue, 24 Aug 2021 17:58:39 +0800 Subject: [PATCH] a patch for issue #73 the problem is that during the computation of the lines, the cursor isn't wrapping to the next line if the last character would render "into" the edge of the box. adding a trailing space to any incoming strings forces the line to wrap. you can aggravate this condition by typing the following sentence into the shell: this is a test of a message that is too long a message when it fails, it renders this is a test of a messag e that is too long a messag adding the trailing space causes it to render as this is a test of a messag e that is too long a messa ge which is the desired behavior --- services/graphics-server/src/main.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/services/graphics-server/src/main.rs b/services/graphics-server/src/main.rs index 968a66296..2ace2035c 100644 --- a/services/graphics-server/src/main.rs +++ b/services/graphics-server/src/main.rs @@ -203,6 +203,9 @@ fn xmain() -> ! { blitstr::xor_char }; + use std::fmt::Write; + write!(tv.text, " ").unwrap(); // appending a trailing space so as to "fix" issue #73 + // first compute the bounding box, if it isn't computed if tv.bounds_computed.is_none() { match tv.bounds_hint { @@ -466,7 +469,6 @@ fn xmain() -> ! { Some(r) => r, _ => continue, // don't draw anything if somehow this doesn't fit in the creen. }; - let mut ref_cursor = blitstr::Cursor::from_top_left_of(cr.into()); if debugtv { log::trace!(