From 1976785b3afce52842b7ae2a3e97b7cbc7809ab0 Mon Sep 17 00:00:00 2001 From: Qijia Liu Date: Sun, 31 Mar 2024 19:22:58 -0400 Subject: [PATCH] hack: trim label end as linux ui impl specific (#95) --- fcitx5-webview | 2 +- webpanel/webpanel.cpp | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/fcitx5-webview b/fcitx5-webview index 5f08700..9648135 160000 --- a/fcitx5-webview +++ b/fcitx5-webview @@ -1 +1 @@ -Subproject commit 5f087005997d1d0721e9e71188d725a0407e5577 +Subproject commit 964813545d238e8d4066dfb030cc7c3a389d7c91 diff --git a/webpanel/webpanel.cpp b/webpanel/webpanel.cpp index f09b1f3..8723d69 100644 --- a/webpanel/webpanel.cpp +++ b/webpanel/webpanel.cpp @@ -115,7 +115,14 @@ void WebPanel::update(UserInterfaceComponent component, instance_ ->outputFilter(inputContext, list->candidate(i).text()) .toString()); - labels.emplace_back(list->label(i).toString()); + auto label = list->label(i).toString(); + // HACK: fcitx5's Linux UI concatenates label and text and + // expects engine to append a ' ' to label. + auto length = label.length(); + if (length && label[length - 1] == ' ') { + label = label.substr(0, length - 1); + } + labels.emplace_back(label); } highlighted = list->cursorIndex(); // }