From 7b56aabe0a498a6d2f3c1b9f59f770ca846b2004 Mon Sep 17 00:00:00 2001 From: Anders Hoglund Date: Sun, 28 Apr 2024 13:18:38 +0200 Subject: [PATCH] Bugfix. CMS label alignment did not consider small screen. --- src/main/cms/cms.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main/cms/cms.c b/src/main/cms/cms.c index 50206be5cd..83893e43c9 100644 --- a/src/main/cms/cms.c +++ b/src/main/cms/cms.c @@ -588,7 +588,18 @@ static int cmsDrawMenuEntry(displayPort_t *pDisplay, const OSD_Entry *p, uint8_t case OME_Label: if (IS_PRINTVALUE(*flags) && p->data) { // A label with optional string, immediately following text - cnt = cmsDisplayWrite(pDisplay, leftMenuColumn + 1 + (uint8_t)strlen(p->text), row, DISPLAYPORT_ATTR_NONE, p->data); + uint8_t start_column = leftMenuColumn; + if (smallScreen) { +#ifdef CMS_OSD_RIGHT_ALIGNED_VALUES + if ((uint8_t)strlen(p->data) <= rightMenuColumn) { + start_column = rightMenuColumn - (uint8_t)strlen(p->data); + } +#endif + } + else { + start_column += (uint8_t)strlen(p->text) +1; + } + cnt = cmsDisplayWrite(pDisplay, start_column, row, DISPLAYPORT_ATTR_NONE, p->data); CLR_PRINTVALUE(*flags); } break;