{"action":"created","comment":{"url":"https://api.github.com/repos/The-Compiler/qutebrowser/pulls/comments/26192585","id":26192585,"diff_hunk":"@@ -215,6 +215,63 @@ def _init_settings(self):\n                 self.new_item(cat, name, desc)\n \n \n+class UrlCompletionModel(base.BaseCompletionModel):\n+\n+    \"\"\"A CompletionModel which combines both quickmarks and web history\n+    URLs. Used for the `open` command.\"\"\"\n+\n+    def __init__(self, match_field='url', parent=None):\n+        super().__init__(parent)\n+\n+        self._quickcat = self.new_category(\"Quickmarks\")\n+        self._histcat = self.new_category(\"History\")\n+        self._histstore = objreg.get('web-history')\n+\n+        WebHistoryCompletionModel.fill_model(self, cat=self._histcat)\n+        QuickmarkCompletionModel.fill_model(self, cat=self._quickcat)\n+\n+        self._histstore.item_added.connect(lambda e:\n+                                        WebHistoryCompletionModel.history_changed(\n+                                            self, e, self._histcat))\n+\n+    def sort(self, column, order=Qt.AscendingOrder):\n+        # sort on atime, descending\n+        # Ignoring the arguments because they are hardcoded in the CFM\n+        # anyway.\n+        self._histcat.sortChildren(2, Qt.DescendingOrder)\n+\n+\n+class WebHistoryCompletionModel(base.BaseCompletionModel):\n+\n+    \"\"\"A CompletionModel filled with global browsing history.\"\"\"\n+\n+    # pylint: disable=abstract-method\n+\n+    def __init__(self, match_field='url', parent=None):\n+        super().__init__(parent)\n+\n+        self._histcat = self.new_category(\"History\")\n+        self._histstore = objreg.get('web-history')\n+\n+        self.fill_model(self, self._histcat, self._histstore)\n+\n+        self._histstore.item_added.connect(lambda e:\n+                                        self.history_changed(e, self._histcat))","path":"qutebrowser/completion/models/completion.py","position":45,"original_position":45,"commit_id":"0d9fab929454999ab87bcca8f7dd127afa39c20a","original_commit_id":"0d9fab929454999ab87bcca8f7dd127afa39c20a","user":{"login":"The-Compiler","id":625793,"avatar_url":"https://avatars.githubusercontent.com/u/625793?v=3","gravatar_id":"","url":"https://api.github.com/users/The-Compiler","html_url":"https://github.com/The-Compiler","followers_url":"https://api.github.com/users/The-Compiler/followers","following_url":"https://api.github.com/users/The-Compiler/following{/other_user}","gists_url":"https://api.github.com/users/The-Compiler/gists{/gist_id}","starred_url":"https://api.github.com/users/The-Compiler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/The-Compiler/subscriptions","organizations_url":"https://api.github.com/users/The-Compiler/orgs","repos_url":"https://api.github.com/users/The-Compiler/repos","events_url":"https://api.github.com/users/The-Compiler/events{/privacy}","received_events_url":"https://api.github.com/users/The-Compiler/received_events","type":"User","site_admin":false},"body":"```python\r\n        self._histstore.item_added.connect(\r\n            lambda e: self.history_changed(e, self._histcat))\r\n```","created_at":"2015-03-11T07:17:32Z","updated_at":"2015-03-11T07:17:32Z","html_url":"https://github.com/The-Compiler/qutebrowser/pull/531#discussion_r26192585","pull_request_url":"https://api.github.com/repos/The-Compiler/qutebrowser/pulls/531","_links":{"self":{"href":"https://api.github.com/repos/The-Compiler/qutebrowser/pulls/comments/26192585"},"html":{"href":"https://github.com/The-Compiler/qutebrowser/pull/531#discussion_r26192585"},"pull_request":{"href":"https://api.github.com/repos/The-Compiler/qutebrowser/pulls/531"}}},"pull_request":{"url":"https://api.github.com/repos/The-Compiler/qutebrowser/pulls/531","id":30528427,"html_url":"https://github.com/The-Compiler/qutebrowser/pull/531","diff_url":"https://github.com/The-Compiler/qutebrowser/pull/531.diff","patch_url":"https://github.com/The-Compiler/qutebrowser/pull/531.patch","issue_url":"https://api.github.com/repos/The-Compiler/qutebrowser/issues/531","number":531,"state":"open","locked":false,"title":"Add url history completion for open.","user":{"login":"toofar","id":7419144,"avatar_url":"https://avatars.githubusercontent.com/u/7419144?v=3","gravatar_id":"","url":"https://api.github.com/users/toofar","html_url":"https://github.com/toofar","followers_url":"https://api.github.com/users/toofar/followers","following_url":"https://api.github.com/users/toofar/following{/other_user}","gists_url":"https://api.github.com/users/toofar/gists{/gist_id}","starred_url":"https://api.github.com/users/toofar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/toofar/subscriptions","organizations_url":"https://api.github.com/users/toofar/orgs","repos_url":"https://api.github.com/users/toofar/repos","events_url":"https://api.github.com/users/toofar/events{/privacy}","received_events_url":"https://api.github.com/users/toofar/received_events","type":"User","site_admin":false},"body":"Add url history completion for open.\r\n\r\nI mostly just copied this off of the quickmark completion. It probably\r\nisn't done yet but I had some questions to raise. Also I see you have a\r\nnewhistory branch but can't see any conflicts on there yet.\r\n\r\nI wanted to have the open command complete on history and on quickmarks\r\n(well, I don't care about completing on quickmarks but I don't want to\r\nbreak it). When commands are registered multiple completion models can\r\nbe passed in but it seems that only one of them is used. Is there any\r\nway to chain completions or should I just create a new\r\nOpenCommandCompletionModel or something which does both?\r\n\r\nWhen the WebHistoryCompletionModel gets a history changed signal it just\r\npops off the most recent history to add to the completion model. I am\r\nnot sure how these signals are handled. Is it possible the history to be\r\nappended to a second time before the signal gets handled? If so I will\r\neither change it to walk backwards through history until it sees one it\r\nhas seen before or change the signal to a typed signal (I think these\r\nare a thing) that passes the new history entry to the handlers.\r\n\r\nLastly there was a NoneType has no method casefold() exception being\r\nthrown when using this new completion model and I don't know why that\r\nwasn't showing up when using the quickmarks completion. To reproduce it\r\njust remove the `if not data` check and try to open a new page by using\r\nthe open command and not selecting one of the completion options. I don't\r\nknow whether this is a bug I have caused or just exposed.\r\n\r\nLastly it would be nice to be able to complete based on page title too.\r\nSince the QWebHistoryInterface API doesn't pass this information would\r\nyou consider adding history items at an appropriate stage of loading\r\nfrom in qutebrowser? Like these guys did: https://git.reviewboard.kde.org/r/104257/diff/2/#1","created_at":"2015-03-05T03:54:58Z","updated_at":"2015-03-11T07:17:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"417ba0bc0966813b58f567798158974b8cb45c80","assignee":{"login":"The-Compiler","id":625793,"avatar_url":"https://avatars.githubusercontent.com/u/625793?v=3","gravatar_id":"","url":"https://api.github.com/users/The-Compiler","html_url":"https://github.com/The-Compiler","followers_url":"https://api.github.com/users/The-Compiler/followers","following_url":"https://api.github.com/users/The-Compiler/following{/other_user}","gists_url":"https://api.github.com/users/The-Compiler/gists{/gist_id}","starred_url":"https://api.github.com/users/The-Compiler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/The-Compiler/subscriptions","organizations_url":"https://api.github.com/users/The-Compiler/orgs","repos_url":"https://api.github.com/users/The-Compiler/repos","events_url":"https://api.github.com/users/The-Compiler/events{/privacy}","received_events_url":"https://api.github.com/users/The-Compiler/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/The-Compiler/qutebrowser/milestones/2","html_url":"https://github.com/The-Compiler/qutebrowser/milestones/v0.2","labels_url":"https://api.github.com/repos/The-Compiler/qutebrowser/milestones/2/labels","id":886476,"number":2,"title":"v0.2","description":"","creator":{"login":"The-Compiler","id":625793,"avatar_url":"https://avatars.githubusercontent.com/u/625793?v=3","gravatar_id":"","url":"https://api.github.com/users/The-Compiler","html_url":"https://github.com/The-Compiler","followers_url":"https://api.github.com/users/The-Compiler/followers","following_url":"https://api.github.com/users/The-Compiler/following{/other_user}","gists_url":"https://api.github.com/users/The-Compiler/gists{/gist_id}","starred_url":"https://api.github.com/users/The-Compiler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/The-Compiler/subscriptions","organizations_url":"https://api.github.com/users/The-Compiler/orgs","repos_url":"https://api.github.com/users/The-Compiler/repos","events_url":"https://api.github.com/users/The-Compiler/events{/privacy}","received_events_url":"https://api.github.com/users/The-Compiler/received_events","type":"User","site_admin":false},"open_issues":14,"closed_issues":45,"state":"open","created_at":"2014-12-01T19:27:55Z","updated_at":"2015-03-11T06:57:57Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/The-Compiler/qutebrowser/pulls/531/commits","review_comments_url":"https://api.github.com/repos/The-Compiler/qutebrowser/pulls/531/comments","review_comment_url":"https://api.github.com/repos/The-Compiler/qutebrowser/pulls/comments{/number}","comments_url":"https://api.github.com/repos/The-Compiler/qutebrowser/issues/531/comments","statuses_url":"https://api.github.com/repos/The-Compiler/qutebrowser/statuses/0d9fab929454999ab87bcca8f7dd127afa39c20a","head":{"label":"toofar:histcomplete","ref":"histcomplete","sha":"0d9fab929454999ab87bcca8f7dd127afa39c20a","user":{"login":"toofar","id":7419144,"avatar_url":"https://avatars.githubusercontent.com/u/7419144?v=3","gravatar_id":"","url":"https://api.github.com/users/toofar","html_url":"https://github.com/toofar","followers_url":"https://api.github.com/users/toofar/followers","following_url":"https://api.github.com/users/toofar/following{/other_user}","gists_url":"https://api.github.com/users/toofar/gists{/gist_id}","starred_url":"https://api.github.com/users/toofar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/toofar/subscriptions","organizations_url":"https://api.github.com/users/toofar/orgs","repos_url":"https://api.github.com/users/toofar/repos","events_url":"https://api.github.com/users/toofar/events{/privacy}","received_events_url":"https://api.github.com/users/toofar/received_events","type":"User","site_admin":false},"repo":{"id":31693282,"name":"qutebrowser","full_name":"toofar/qutebrowser","owner":{"login":"toofar","id":7419144,"avatar_url":"https://avatars.githubusercontent.com/u/7419144?v=3","gravatar_id":"","url":"https://api.github.com/users/toofar","html_url":"https://github.com/toofar","followers_url":"https://api.github.com/users/toofar/followers","following_url":"https://api.github.com/users/toofar/following{/other_user}","gists_url":"https://api.github.com/users/toofar/gists{/gist_id}","starred_url":"https://api.github.com/users/toofar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/toofar/subscriptions","organizations_url":"https://api.github.com/users/toofar/orgs","repos_url":"https://api.github.com/users/toofar/repos","events_url":"https://api.github.com/users/toofar/events{/privacy}","received_events_url":"https://api.github.com/users/toofar/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/toofar/qutebrowser","description":"A keyboard-driven, vim-like browser based on PyQt5 and QtWebKit.","fork":true,"url":"https://api.github.com/repos/toofar/qutebrowser","forks_url":"https://api.github.com/repos/toofar/qutebrowser/forks","keys_url":"https://api.github.com/repos/toofar/qutebrowser/keys{/key_id}","collaborators_url":"https://api.github.com/repos/toofar/qutebrowser/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/toofar/qutebrowser/teams","hooks_url":"https://api.github.com/repos/toofar/qutebrowser/hooks","issue_events_url":"https://api.github.com/repos/toofar/qutebrowser/issues/events{/number}","events_url":"https://api.github.com/repos/toofar/qutebrowser/events","assignees_url":"https://api.github.com/repos/toofar/qutebrowser/assignees{/user}","branches_url":"https://api.github.com/repos/toofar/qutebrowser/branches{/branch}","tags_url":"https://api.github.com/repos/toofar/qutebrowser/tags","blobs_url":"https://api.github.com/repos/toofar/qutebrowser/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/toofar/qutebrowser/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/toofar/qutebrowser/git/refs{/sha}","trees_url":"https://api.github.com/repos/toofar/qutebrowser/git/trees{/sha}","statuses_url":"https://api.github.com/repos/toofar/qutebrowser/statuses/{sha}","languages_url":"https://api.github.com/repos/toofar/qutebrowser/languages","stargazers_url":"https://api.github.com/repos/toofar/qutebrowser/stargazers","contributors_url":"https://api.github.com/repos/toofar/qutebrowser/contributors","subscribers_url":"https://api.github.com/repos/toofar/qutebrowser/subscribers","subscription_url":"https://api.github.com/repos/toofar/qutebrowser/subscription","commits_url":"https://api.github.com/repos/toofar/qutebrowser/commits{/sha}","git_commits_url":"https://api.github.com/repos/toofar/qutebrowser/git/commits{/sha}","comments_url":"https://api.github.com/repos/toofar/qutebrowser/comments{/number}","issue_comment_url":"https://api.github.com/repos/toofar/qutebrowser/issues/comments{/number}","contents_url":"https://api.github.com/repos/toofar/qutebrowser/contents/{+path}","compare_url":"https://api.github.com/repos/toofar/qutebrowser/compare/{base}...{head}","merges_url":"https://api.github.com/repos/toofar/qutebrowser/merges","archive_url":"https://api.github.com/repos/toofar/qutebrowser/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/toofar/qutebrowser/downloads","issues_url":"https://api.github.com/repos/toofar/qutebrowser/issues{/number}","pulls_url":"https://api.github.com/repos/toofar/qutebrowser/pulls{/number}","milestones_url":"https://api.github.com/repos/toofar/qutebrowser/milestones{/number}","notifications_url":"https://api.github.com/repos/toofar/qutebrowser/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/toofar/qutebrowser/labels{/name}","releases_url":"https://api.github.com/repos/toofar/qutebrowser/releases{/id}","created_at":"2015-03-05T03:17:20Z","updated_at":"2015-03-11T03:19:33Z","pushed_at":"2015-03-11T03:19:32Z","git_url":"git://github.com/toofar/qutebrowser.git","ssh_url":"git@github.com:toofar/qutebrowser.git","clone_url":"https://github.com/toofar/qutebrowser.git","svn_url":"https://github.com/toofar/qutebrowser","homepage":null,"size":5155,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"The-Compiler:master","ref":"master","sha":"5ab052c40fe65d8e68380ccdf6872af620282dcf","user":{"login":"The-Compiler","id":625793,"avatar_url":"https://avatars.githubusercontent.com/u/625793?v=3","gravatar_id":"","url":"https://api.github.com/users/The-Compiler","html_url":"https://github.com/The-Compiler","followers_url":"https://api.github.com/users/The-Compiler/followers","following_url":"https://api.github.com/users/The-Compiler/following{/other_user}","gists_url":"https://api.github.com/users/The-Compiler/gists{/gist_id}","starred_url":"https://api.github.com/users/The-Compiler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/The-Compiler/subscriptions","organizations_url":"https://api.github.com/users/The-Compiler/orgs","repos_url":"https://api.github.com/users/The-Compiler/repos","events_url":"https://api.github.com/users/The-Compiler/events{/privacy}","received_events_url":"https://api.github.com/users/The-Compiler/received_events","type":"User","site_admin":false},"repo":{"id":21244505,"name":"qutebrowser","full_name":"The-Compiler/qutebrowser","owner":{"login":"The-Compiler","id":625793,"avatar_url":"https://avatars.githubusercontent.com/u/625793?v=3","gravatar_id":"","url":"https://api.github.com/users/The-Compiler","html_url":"https://github.com/The-Compiler","followers_url":"https://api.github.com/users/The-Compiler/followers","following_url":"https://api.github.com/users/The-Compiler/following{/other_user}","gists_url":"https://api.github.com/users/The-Compiler/gists{/gist_id}","starred_url":"https://api.github.com/users/The-Compiler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/The-Compiler/subscriptions","organizations_url":"https://api.github.com/users/The-Compiler/orgs","repos_url":"https://api.github.com/users/The-Compiler/repos","events_url":"https://api.github.com/users/The-Compiler/events{/privacy}","received_events_url":"https://api.github.com/users/The-Compiler/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/The-Compiler/qutebrowser","description":"A keyboard-driven, vim-like browser based on PyQt5 and QtWebKit.","fork":false,"url":"https://api.github.com/repos/The-Compiler/qutebrowser","forks_url":"https://api.github.com/repos/The-Compiler/qutebrowser/forks","keys_url":"https://api.github.com/repos/The-Compiler/qutebrowser/keys{/key_id}","collaborators_url":"https://api.github.com/repos/The-Compiler/qutebrowser/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/The-Compiler/qutebrowser/teams","hooks_url":"https://api.github.com/repos/The-Compiler/qutebrowser/hooks","issue_events_url":"https://api.github.com/repos/The-Compiler/qutebrowser/issues/events{/number}","events_url":"https://api.github.com/repos/The-Compiler/qutebrowser/events","assignees_url":"https://api.github.com/repos/The-Compiler/qutebrowser/assignees{/user}","branches_url":"https://api.github.com/repos/The-Compiler/qutebrowser/branches{/branch}","tags_url":"https://api.github.com/repos/The-Compiler/qutebrowser/tags","blobs_url":"https://api.github.com/repos/The-Compiler/qutebrowser/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/The-Compiler/qutebrowser/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/The-Compiler/qutebrowser/git/refs{/sha}","trees_url":"https://api.github.com/repos/The-Compiler/qutebrowser/git/trees{/sha}","statuses_url":"https://api.github.com/repos/The-Compiler/qutebrowser/statuses/{sha}","languages_url":"https://api.github.com/repos/The-Compiler/qutebrowser/languages","stargazers_url":"https://api.github.com/repos/The-Compiler/qutebrowser/stargazers","contributors_url":"https://api.github.com/repos/The-Compiler/qutebrowser/contributors","subscribers_url":"https://api.github.com/repos/The-Compiler/qutebrowser/subscribers","subscription_url":"https://api.github.com/repos/The-Compiler/qutebrowser/subscription","commits_url":"https://api.github.com/repos/The-Compiler/qutebrowser/commits{/sha}","git_commits_url":"https://api.github.com/repos/The-Compiler/qutebrowser/git/commits{/sha}","comments_url":"https://api.github.com/repos/The-Compiler/qutebrowser/comments{/number}","issue_comment_url":"https://api.github.com/repos/The-Compiler/qutebrowser/issues/comments{/number}","contents_url":"https://api.github.com/repos/The-Compiler/qutebrowser/contents/{+path}","compare_url":"https://api.github.com/repos/The-Compiler/qutebrowser/compare/{base}...{head}","merges_url":"https://api.github.com/repos/The-Compiler/qutebrowser/merges","archive_url":"https://api.github.com/repos/The-Compiler/qutebrowser/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/The-Compiler/qutebrowser/downloads","issues_url":"https://api.github.com/repos/The-Compiler/qutebrowser/issues{/number}","pulls_url":"https://api.github.com/repos/The-Compiler/qutebrowser/pulls{/number}","milestones_url":"https://api.github.com/repos/The-Compiler/qutebrowser/milestones{/number}","notifications_url":"https://api.github.com/repos/The-Compiler/qutebrowser/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/The-Compiler/qutebrowser/labels{/name}","releases_url":"https://api.github.com/repos/The-Compiler/qutebrowser/releases{/id}","created_at":"2014-06-26T14:59:34Z","updated_at":"2015-03-11T06:52:59Z","pushed_at":"2015-03-11T06:52:59Z","git_url":"git://github.com/The-Compiler/qutebrowser.git","ssh_url":"git@github.com:The-Compiler/qutebrowser.git","clone_url":"https://github.com/The-Compiler/qutebrowser.git","svn_url":"https://github.com/The-Compiler/qutebrowser","homepage":null,"size":8937,"stargazers_count":484,"watchers_count":484,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":49,"mirror_url":null,"open_issues_count":198,"forks":49,"open_issues":198,"watchers":484,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/The-Compiler/qutebrowser/pulls/531"},"html":{"href":"https://github.com/The-Compiler/qutebrowser/pull/531"},"issue":{"href":"https://api.github.com/repos/The-Compiler/qutebrowser/issues/531"},"comments":{"href":"https://api.github.com/repos/The-Compiler/qutebrowser/issues/531/comments"},"review_comments":{"href":"https://api.github.com/repos/The-Compiler/qutebrowser/pulls/531/comments"},"review_comment":{"href":"https://api.github.com/repos/The-Compiler/qutebrowser/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/The-Compiler/qutebrowser/pulls/531/commits"},"statuses":{"href":"https://api.github.com/repos/The-Compiler/qutebrowser/statuses/0d9fab929454999ab87bcca8f7dd127afa39c20a"}}}}