From 59bbca9b40770faccd6bac79145bb2e67905c908 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 16 Mar 2015 09:20:09 +0100 Subject: [PATCH] Fix updating of existing items in hist-completion. Before we limited the history items we could simply call WebHistory's historyContains before iterating through all items in the history completion. Now however it's possible an item is in the real WebHistory, but not actually in the completion - so we always have to check the whole completion. --- qutebrowser/completion/models/urlmodel.py | 24 ++++++++++------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/qutebrowser/completion/models/urlmodel.py b/qutebrowser/completion/models/urlmodel.py index 9f97a2d09..100defbf1 100644 --- a/qutebrowser/completion/models/urlmodel.py +++ b/qutebrowser/completion/models/urlmodel.py @@ -83,17 +83,13 @@ class UrlCompletionModel(base.BaseCompletionModel): @pyqtSlot(object) def on_history_item_added(self, entry): """Slot called when a new history item was added.""" - if entry.url_string: - if self._history.historyContains(entry.url_string): - for i in range(self._history_cat.rowCount()): - name_item = self._history_cat.child(i, 0) - atime_item = self._history_cat.child(i, 2) - if not name_item: - continue - url = name_item.data(base.Role.userdata) - if url == entry.url: - atime_item.setText(self._fmt_atime(entry.atime)) - name_item.setData(int(entry.atime), base.Role.sort) - break - else: - self._add_history_entry(entry) + for i in range(self._history_cat.rowCount()): + name_item = self._history_cat.child(i, 0) + atime_item = self._history_cat.child(i, 2) + url = name_item.data(base.Role.userdata) + if url == entry.url: + atime_item.setText(self._fmt_atime(entry.atime)) + name_item.setData(int(entry.atime), base.Role.sort) + break + else: + self._add_history_entry(entry)