Skip to content

Commit

Permalink
Fix updating of existing items in hist-completion.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
The-Compiler committed Mar 16, 2015
1 parent 806742a commit 59bbca9
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions qutebrowser/completion/models/urlmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,17 +83,13 @@ def reformat_timestamps(self):
@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)

0 comments on commit 59bbca9

Please sign in to comment.