diff --git a/itemcontroller.lua b/itemcontroller.lua index ebca403..c94731f 100644 --- a/itemcontroller.lua +++ b/itemcontroller.lua @@ -140,11 +140,13 @@ local function getCenterPad(contentWidth, widthBudget) return math.floor(pad), math.ceil(pad) end -local function fitText(text, widthBudget) +local function fitText(text, widthBudget, alignEnd) if #text <= widthBudget then return text end - return text:sub(1, widthBudget) + local textStart = alignEnd and (#text - widthBudget + 1) or 1 + local textEnd = (alignEnd and #text - textStart) or widthBudget + return text:sub(textStart, textEnd) end local PAGES = { @@ -558,7 +560,7 @@ local PAGES = { local keyboardInnerWidth = keyboardList:getInnerWidth() - local filterDisplayedText = fitText(pageState.filter, keyboardInnerWidth) + local filterDisplayedText = fitText(pageState.filter, keyboardInnerWidth, true) local filterText = keyboardList:findById(ID_FILTER_DISPLAY) filterText:setText(filterDisplayedText)