Viewer/Content server: Fix history for completion popups such as search bars not being stored correctly. Fixes #1847976 [feature request: viewer 4 search history as in viewer 3](https://bugs.launchpad.net/calibre/+bug/1847976)

This commit is contained in:
Kovid Goyal 2019-11-08 06:43:25 +05:30
parent caad54863b
commit c0acccde24
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -83,7 +83,7 @@ def create_search_bar(action, name, tooltip=None, placeholder=None, button=None,
items = local_storage().get(history_name) or v'[]' items = local_storage().get(history_name) or v'[]'
idx = items.indexOf(text) idx = items.indexOf(text)
if idx > -1: if idx > -1:
items = items.splice(idx, 1) items.splice(idx, 1)
items.unshift(text) items.unshift(text)
local_storage().set(history_name, uniq(items[:history_size])) local_storage().set(history_name, uniq(items[:history_size]))
update_completion_items() update_completion_items()