From 8b992bbe381dab325d2ee1932c874eea689e8ac2 Mon Sep 17 00:00:00 2001 From: bunnie Date: Thu, 29 Jul 2021 01:02:44 +0800 Subject: [PATCH] fix shorter-than-one-line text fitting problem right character gets cut off, but it's because the cursor is the top left of the last character. add one character height plus margin to the shortening, because the margin itself could be 0 in many case. --- services/graphics-server/src/main.rs | 12 ++++++------ services/{gam => status}/locales/i18n.json | 0 2 files changed, 6 insertions(+), 6 deletions(-) rename services/{gam => status}/locales/i18n.json (100%) diff --git a/services/graphics-server/src/main.rs b/services/graphics-server/src/main.rs index 2182d12e7..232261a16 100644 --- a/services/graphics-server/src/main.rs +++ b/services/graphics-server/src/main.rs @@ -192,8 +192,8 @@ fn xmain() -> ! { }; // if less than one line of text, shrink the box let finalwidth = if c.pt.y == 0 { - if c.pt.x as i16 + tv.margin.x * 3 < checkedwidth { - c.pt.x as i16 + tv.margin.x * 3 + if c.pt.x as i16 + c.line_height as i16 + tv.margin.x < checkedwidth { + c.pt.x as i16 + c.line_height as i16 + tv.margin.x } else { checkedwidth } @@ -243,8 +243,8 @@ fn xmain() -> ! { // if less than one line of text, shrink the box let finalwidth = if c.pt.y == 0 { - if c.pt.x as i16 + tv.margin.x * 3 < checkedwidth { - c.pt.x as i16 + tv.margin.x * 3 + if c.pt.x as i16 + c.line_height as i16 + tv.margin.x < checkedwidth { + c.pt.x as i16 + c.line_height as i16 + tv.margin.x } else { checkedwidth } @@ -299,8 +299,8 @@ fn xmain() -> ! { // if less than one line of text, shrink the box let finalwidth = if c.pt.y == 0 { - if c.pt.x as i16 + tv.margin.x * 3 < checkedwidth { - c.pt.x as i16 + tv.margin.x * 3 + if c.pt.x as i16 + c.line_height as i16 + tv.margin.x < checkedwidth { + c.pt.x as i16 + c.line_height as i16 + tv.margin.x } else { checkedwidth } diff --git a/services/gam/locales/i18n.json b/services/status/locales/i18n.json similarity index 100% rename from services/gam/locales/i18n.json rename to services/status/locales/i18n.json