Only refresh if filter is not empty

This commit is contained in:
Gabriel Tofvesson 2024-11-14 03:29:27 +00:00
parent da30f475c9
commit f2b6f737da

View File

@ -447,8 +447,10 @@ local PAGES = {
text = "<--",
bgColor = KEYBOARD_KEY_COLOR,
onClick = function()
pageState.filter = fitText(pageState.filter, math.max(0, #pageState.filter - 1))
pageState.reloadState()
if #pageState.filter > 0 then
pageState.filter = fitText(pageState.filter, math.max(0, #pageState.filter - 1))
pageState.reloadState()
end
return true
end
})
@ -482,8 +484,10 @@ local PAGES = {
onClick = ignoreClick,
onKey = function(elem, keyCode, held)
if keyCode == keys.backspace then
pageState.filter = fitText(pageState.filter, math.max(0, #pageState.filter - 1))
pageState.reloadState()
if #pageState.filter > 0 then
pageState.filter = fitText(pageState.filter, math.max(0, #pageState.filter - 1))
pageState.reloadState()
end
return true
end
return false