Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Histcomplete some fixes for #547 #548

Merged
merged 3 commits into from
Mar 12, 2015

Conversation

toofar
Copy link
Member

@toofar toofar commented Mar 12, 2015

Here's a couple of commits for the histcomplete branch. I cleaned up that confusing comment (which is there in case anyone goes looking for history stats like number if hits for some reason and wonders why we are throwing that info away, for now). And added some code to remove duplicates, both when iterating WebHistory and in the completion model.


This change is Reviewable

Two things here. One is to use `WebHistory._new_history` only as a to-save
queue, so we now add entries to `_old_urls` when they are first created and
can now no longer iterate of `_new_history` in `__iter__()`.

Second is to stop blindly tacking new history entries on the end of the
history completion model. It does involve iterating over the model to find the
existing entry but we only do that if we know the duplicate is there, which is
fast to check.

This also ads another point of mutation to the history completion model which
may prove problematic if it leads to more segfaults.
@@ -99,8 +99,7 @@ def __getitem__(self, key):
return self._new_history[key]

def __iter__(self):
return itertools.chain(self._old_urls.values(),
iter(self._new_history))
return self._old_urls.values().__iter__()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do iter(self._old_urls.values()) instead - I think it does the same in this case, but it's usually discouraged to call magic methods directly.

@The-Compiler
Copy link
Member

Some more small remarks:

  • I think _old_urls should be renamed to _history_dict or so now.
  • historyContains can be simplified now everything is in _history_dict, it doesn't have to check _new_history anymore.

@The-Compiler The-Compiler merged commit 61e732f into qutebrowser:histcomplete Mar 12, 2015
The-Compiler added a commit that referenced this pull request Mar 12, 2015
The need for those were removed in #548.
@The-Compiler The-Compiler added the component: completion Issues related to the commandline completion or history. label Jun 16, 2015
@toofar toofar deleted the histcomplete branch February 16, 2019 04:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: completion Issues related to the commandline completion or history.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants