From a4a96c9c561a59531c54996b4319662618b62a3f Mon Sep 17 00:00:00 2001 From: bunnie Date: Tue, 9 Mar 2021 02:23:49 +0800 Subject: [PATCH] add ellpsis support to textview --- services/graphics-server/src/api/text.rs | 2 ++ services/graphics-server/src/main.rs | 3 +++ 2 files changed, 5 insertions(+) diff --git a/services/graphics-server/src/api/text.rs b/services/graphics-server/src/api/text.rs index 1e15dd5b1..b22b43f35 100644 --- a/services/graphics-server/src/api/text.rs +++ b/services/graphics-server/src/api/text.rs @@ -68,6 +68,7 @@ pub struct TextView { pub text: xous::String::<3072>, pub cursor: Cursor, pub insertion: Option, // this is the insertion point offset, if it's to be drawn, on the string + pub ellipsis: bool, pub draw_border: bool, pub clear_area: bool, // you almost always want this to be true @@ -96,6 +97,7 @@ impl TextView { text: xous::String::<3072>::new(), cursor: Cursor::new(0,0,0), insertion: None, + ellipsis: false, draw_border: true, border_width: 1, rounded_border: None, diff --git a/services/graphics-server/src/main.rs b/services/graphics-server/src/main.rs index 50f1c2268..db53adce6 100644 --- a/services/graphics-server/src/main.rs +++ b/services/graphics-server/src/main.rs @@ -116,6 +116,7 @@ fn xmain() -> ! { s.as_str().unwrap(), false, None, + false, blitstr::xor_char ); //info!("GFX: string painted"); @@ -130,6 +131,7 @@ fn xmain() -> ! { s.as_str().unwrap(), true, None, + false, blitstr::xor_char ); }, @@ -246,6 +248,7 @@ fn xmain() -> ! { tv.text.as_str().unwrap(), false, tv.insertion, + tv.ellipsis, paintfn ); // translate the cursor return value back to canvas coordinates