{"action":"created","comment":{"url":"https://api.github.com/repos/bpython/bpython/pulls/comments/47529194","id":47529194,"diff_hunk":"@@ -460,7 +414,86 @@ def smarter_request_reload(files_modified=()):\n \n         self.status_bar.message(banner)\n \n-        self.watcher = ModuleChangedEventHandler([], smarter_request_reload)\n+        self.watcher = ModuleChangedEventHandler([], self.request_reload)\n+\n+    ### These methods should be overridden, but the default implementations below\n+    ### can be used as well.\n+\n+    def get_cursor_vertical_diff(self):\n+        \"\"\"Return how the cursor moved due to a window size change\"\"\"\n+        return 0\n+\n+    def get_term_hw(self):\n+        \"\"\"Returns the current width and height of the display area.\"\"\"\n+        return (50, 10)\n+\n+    def _schedule_refresh(self, when='now'):\n+        \"\"\"Arrange for the bpython display to be refreshed soon.\n+\n+        This method will be called when the Repl wants the display to be\n+        refreshed at a known point in the future, and as such it should\n+        interrupt a pending request to the user for input.\n+\n+        Because the worst-case effect of not refreshing\n+        is only having an out of date UI until the user enters input, a\n+        default NOP implementation is provided.\"\"\"\n+\n+    ### These methods must be overridden in subclasses\n+\n+    def _request_refresh(self):\n+        \"\"\"Arrange for the bpython display to be refreshed soon.\n+\n+        This method will be called when the Repl wants to refresh the display,\n+        but wants control returned to it afterwards. (it is assumed that simply\n+        returning from process_event will cause an event refresh)\n+\n+        The very next event received by process_event should be a\n+        RefreshRequestEvent.\"\"\"\n+        raise NotImplementedError\n+\n+    def _request_reload(self, files_modified=('?',)):\n+        \"\"\"Like request_refresh, but for reload requests events.\"\"\"\n+        raise NotImplementedError\n+\n+    def request_undo(self, n=1):\n+        \"\"\"ike request_refresh, but for undo request events.\"\"\"\n+        raise NotImplementedError\n+\n+    def on_suspend():\n+        \"\"\"Will be called on sigtstp.\n+\n+        Do whatever cleanup would allow the user to use other programs.\"\"\"\n+        raise NotImplementedError\n+\n+    def after_suspend():\n+        \"\"\"Will be called when process foregrounded after suspend.\n+\n+        See to it that process_event is called with None to trigger a refresh\n+        if not in the middle of a process_event call when suspend happened.\"\"\"\n+        raise NotImplementedError\n+\n+    ### End methods that should be overridden in subclass\n+\n+    def request_refresh(self):\n+        \"\"\"Arrange for the bpython display to be refreshed soon.\"\"\"\n+        if self.reevaluating or self.paste_mode:\n+            self.fake_refresh_requested = True\n+        else:\n+            self._request_refresh()\n+\n+    def request_reload(self, files_modified=()):\n+        \"\"\"Arrange for the \"\"\"","path":"bpython/curtsiesfrontend/repl.py","position":197,"original_position":197,"commit_id":"2a8bf7ec798def794f31b17aca7993da3c12d08e","original_commit_id":"2a8bf7ec798def794f31b17aca7993da3c12d08e","user":{"login":"sebastinas","id":114613,"avatar_url":"https://avatars.githubusercontent.com/u/114613?v=3","gravatar_id":"","url":"https://api.github.com/users/sebastinas","html_url":"https://github.com/sebastinas","followers_url":"https://api.github.com/users/sebastinas/followers","following_url":"https://api.github.com/users/sebastinas/following{/other_user}","gists_url":"https://api.github.com/users/sebastinas/gists{/gist_id}","starred_url":"https://api.github.com/users/sebastinas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sebastinas/subscriptions","organizations_url":"https://api.github.com/users/sebastinas/orgs","repos_url":"https://api.github.com/users/sebastinas/repos","events_url":"https://api.github.com/users/sebastinas/events{/privacy}","received_events_url":"https://api.github.com/users/sebastinas/received_events","type":"User","site_admin":false},"body":"There's something missing.","created_at":"2015-12-14T17:36:44Z","updated_at":"2015-12-14T17:36:44Z","html_url":"https://github.com/bpython/bpython/pull/589#discussion_r47529194","pull_request_url":"https://api.github.com/repos/bpython/bpython/pulls/589","_links":{"self":{"href":"https://api.github.com/repos/bpython/bpython/pulls/comments/47529194"},"html":{"href":"https://github.com/bpython/bpython/pull/589#discussion_r47529194"},"pull_request":{"href":"https://api.github.com/repos/bpython/bpython/pulls/589"}}},"pull_request":{"url":"https://api.github.com/repos/bpython/bpython/pulls/589","id":53565519,"html_url":"https://github.com/bpython/bpython/pull/589","diff_url":"https://github.com/bpython/bpython/pull/589.diff","patch_url":"https://github.com/bpython/bpython/pull/589.patch","issue_url":"https://api.github.com/repos/bpython/bpython/issues/589","number":589,"state":"open","locked":false,"title":"Inheritance over composition","user":{"login":"thomasballinger","id":458879,"avatar_url":"https://avatars.githubusercontent.com/u/458879?v=3","gravatar_id":"","url":"https://api.github.com/users/thomasballinger","html_url":"https://github.com/thomasballinger","followers_url":"https://api.github.com/users/thomasballinger/followers","following_url":"https://api.github.com/users/thomasballinger/following{/other_user}","gists_url":"https://api.github.com/users/thomasballinger/gists{/gist_id}","starred_url":"https://api.github.com/users/thomasballinger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thomasballinger/subscriptions","organizations_url":"https://api.github.com/users/thomasballinger/orgs","repos_url":"https://api.github.com/users/thomasballinger/repos","events_url":"https://api.github.com/users/thomasballinger/events{/privacy}","received_events_url":"https://api.github.com/users/thomasballinger/received_events","type":"User","site_admin":false},"body":"I wasn't sure how I felt about this before, but inheriting and overriding methods seems nicer than passing in a bunch of callbacks to the constructor of the Repl object.","created_at":"2015-12-14T13:40:28Z","updated_at":"2015-12-14T17:36:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c5caa22b2802ca603e224a6bb5b27781705b4727","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/bpython/bpython/pulls/589/commits","review_comments_url":"https://api.github.com/repos/bpython/bpython/pulls/589/comments","review_comment_url":"https://api.github.com/repos/bpython/bpython/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bpython/bpython/issues/589/comments","statuses_url":"https://api.github.com/repos/bpython/bpython/statuses/2a8bf7ec798def794f31b17aca7993da3c12d08e","head":{"label":"bpython:inheritance-over-composition","ref":"inheritance-over-composition","sha":"2a8bf7ec798def794f31b17aca7993da3c12d08e","user":{"login":"bpython","id":8071396,"avatar_url":"https://avatars.githubusercontent.com/u/8071396?v=3","gravatar_id":"","url":"https://api.github.com/users/bpython","html_url":"https://github.com/bpython","followers_url":"https://api.github.com/users/bpython/followers","following_url":"https://api.github.com/users/bpython/following{/other_user}","gists_url":"https://api.github.com/users/bpython/gists{/gist_id}","starred_url":"https://api.github.com/users/bpython/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bpython/subscriptions","organizations_url":"https://api.github.com/users/bpython/orgs","repos_url":"https://api.github.com/users/bpython/repos","events_url":"https://api.github.com/users/bpython/events{/privacy}","received_events_url":"https://api.github.com/users/bpython/received_events","type":"Organization","site_admin":false},"repo":{"id":21508865,"name":"bpython","full_name":"bpython/bpython","owner":{"login":"bpython","id":8071396,"avatar_url":"https://avatars.githubusercontent.com/u/8071396?v=3","gravatar_id":"","url":"https://api.github.com/users/bpython","html_url":"https://github.com/bpython","followers_url":"https://api.github.com/users/bpython/followers","following_url":"https://api.github.com/users/bpython/following{/other_user}","gists_url":"https://api.github.com/users/bpython/gists{/gist_id}","starred_url":"https://api.github.com/users/bpython/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bpython/subscriptions","organizations_url":"https://api.github.com/users/bpython/orgs","repos_url":"https://api.github.com/users/bpython/repos","events_url":"https://api.github.com/users/bpython/events{/privacy}","received_events_url":"https://api.github.com/users/bpython/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bpython/bpython","description":"bpython - A fancy curses interface to the Python interactive interpreter","fork":false,"url":"https://api.github.com/repos/bpython/bpython","forks_url":"https://api.github.com/repos/bpython/bpython/forks","keys_url":"https://api.github.com/repos/bpython/bpython/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bpython/bpython/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bpython/bpython/teams","hooks_url":"https://api.github.com/repos/bpython/bpython/hooks","issue_events_url":"https://api.github.com/repos/bpython/bpython/issues/events{/number}","events_url":"https://api.github.com/repos/bpython/bpython/events","assignees_url":"https://api.github.com/repos/bpython/bpython/assignees{/user}","branches_url":"https://api.github.com/repos/bpython/bpython/branches{/branch}","tags_url":"https://api.github.com/repos/bpython/bpython/tags","blobs_url":"https://api.github.com/repos/bpython/bpython/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bpython/bpython/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bpython/bpython/git/refs{/sha}","trees_url":"https://api.github.com/repos/bpython/bpython/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bpython/bpython/statuses/{sha}","languages_url":"https://api.github.com/repos/bpython/bpython/languages","stargazers_url":"https://api.github.com/repos/bpython/bpython/stargazers","contributors_url":"https://api.github.com/repos/bpython/bpython/contributors","subscribers_url":"https://api.github.com/repos/bpython/bpython/subscribers","subscription_url":"https://api.github.com/repos/bpython/bpython/subscription","commits_url":"https://api.github.com/repos/bpython/bpython/commits{/sha}","git_commits_url":"https://api.github.com/repos/bpython/bpython/git/commits{/sha}","comments_url":"https://api.github.com/repos/bpython/bpython/comments{/number}","issue_comment_url":"https://api.github.com/repos/bpython/bpython/issues/comments{/number}","contents_url":"https://api.github.com/repos/bpython/bpython/contents/{+path}","compare_url":"https://api.github.com/repos/bpython/bpython/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bpython/bpython/merges","archive_url":"https://api.github.com/repos/bpython/bpython/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bpython/bpython/downloads","issues_url":"https://api.github.com/repos/bpython/bpython/issues{/number}","pulls_url":"https://api.github.com/repos/bpython/bpython/pulls{/number}","milestones_url":"https://api.github.com/repos/bpython/bpython/milestones{/number}","notifications_url":"https://api.github.com/repos/bpython/bpython/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bpython/bpython/labels{/name}","releases_url":"https://api.github.com/repos/bpython/bpython/releases{/id}","created_at":"2014-07-04T22:26:05Z","updated_at":"2015-12-13T18:36:06Z","pushed_at":"2015-12-14T13:40:28Z","git_url":"git://github.com/bpython/bpython.git","ssh_url":"git@github.com:bpython/bpython.git","clone_url":"https://github.com/bpython/bpython.git","svn_url":"https://github.com/bpython/bpython","homepage":"http://bpython-interpreter.org/","size":8381,"stargazers_count":280,"watchers_count":280,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":56,"mirror_url":null,"open_issues_count":84,"forks":56,"open_issues":84,"watchers":280,"default_branch":"master"}},"base":{"label":"bpython:master","ref":"master","sha":"6ef2e279ec4940c3d0d130be8e5b2361a08a9fd7","user":{"login":"bpython","id":8071396,"avatar_url":"https://avatars.githubusercontent.com/u/8071396?v=3","gravatar_id":"","url":"https://api.github.com/users/bpython","html_url":"https://github.com/bpython","followers_url":"https://api.github.com/users/bpython/followers","following_url":"https://api.github.com/users/bpython/following{/other_user}","gists_url":"https://api.github.com/users/bpython/gists{/gist_id}","starred_url":"https://api.github.com/users/bpython/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bpython/subscriptions","organizations_url":"https://api.github.com/users/bpython/orgs","repos_url":"https://api.github.com/users/bpython/repos","events_url":"https://api.github.com/users/bpython/events{/privacy}","received_events_url":"https://api.github.com/users/bpython/received_events","type":"Organization","site_admin":false},"repo":{"id":21508865,"name":"bpython","full_name":"bpython/bpython","owner":{"login":"bpython","id":8071396,"avatar_url":"https://avatars.githubusercontent.com/u/8071396?v=3","gravatar_id":"","url":"https://api.github.com/users/bpython","html_url":"https://github.com/bpython","followers_url":"https://api.github.com/users/bpython/followers","following_url":"https://api.github.com/users/bpython/following{/other_user}","gists_url":"https://api.github.com/users/bpython/gists{/gist_id}","starred_url":"https://api.github.com/users/bpython/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bpython/subscriptions","organizations_url":"https://api.github.com/users/bpython/orgs","repos_url":"https://api.github.com/users/bpython/repos","events_url":"https://api.github.com/users/bpython/events{/privacy}","received_events_url":"https://api.github.com/users/bpython/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bpython/bpython","description":"bpython - A fancy curses interface to the Python interactive interpreter","fork":false,"url":"https://api.github.com/repos/bpython/bpython","forks_url":"https://api.github.com/repos/bpython/bpython/forks","keys_url":"https://api.github.com/repos/bpython/bpython/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bpython/bpython/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bpython/bpython/teams","hooks_url":"https://api.github.com/repos/bpython/bpython/hooks","issue_events_url":"https://api.github.com/repos/bpython/bpython/issues/events{/number}","events_url":"https://api.github.com/repos/bpython/bpython/events","assignees_url":"https://api.github.com/repos/bpython/bpython/assignees{/user}","branches_url":"https://api.github.com/repos/bpython/bpython/branches{/branch}","tags_url":"https://api.github.com/repos/bpython/bpython/tags","blobs_url":"https://api.github.com/repos/bpython/bpython/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bpython/bpython/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bpython/bpython/git/refs{/sha}","trees_url":"https://api.github.com/repos/bpython/bpython/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bpython/bpython/statuses/{sha}","languages_url":"https://api.github.com/repos/bpython/bpython/languages","stargazers_url":"https://api.github.com/repos/bpython/bpython/stargazers","contributors_url":"https://api.github.com/repos/bpython/bpython/contributors","subscribers_url":"https://api.github.com/repos/bpython/bpython/subscribers","subscription_url":"https://api.github.com/repos/bpython/bpython/subscription","commits_url":"https://api.github.com/repos/bpython/bpython/commits{/sha}","git_commits_url":"https://api.github.com/repos/bpython/bpython/git/commits{/sha}","comments_url":"https://api.github.com/repos/bpython/bpython/comments{/number}","issue_comment_url":"https://api.github.com/repos/bpython/bpython/issues/comments{/number}","contents_url":"https://api.github.com/repos/bpython/bpython/contents/{+path}","compare_url":"https://api.github.com/repos/bpython/bpython/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bpython/bpython/merges","archive_url":"https://api.github.com/repos/bpython/bpython/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bpython/bpython/downloads","issues_url":"https://api.github.com/repos/bpython/bpython/issues{/number}","pulls_url":"https://api.github.com/repos/bpython/bpython/pulls{/number}","milestones_url":"https://api.github.com/repos/bpython/bpython/milestones{/number}","notifications_url":"https://api.github.com/repos/bpython/bpython/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bpython/bpython/labels{/name}","releases_url":"https://api.github.com/repos/bpython/bpython/releases{/id}","created_at":"2014-07-04T22:26:05Z","updated_at":"2015-12-13T18:36:06Z","pushed_at":"2015-12-14T13:40:28Z","git_url":"git://github.com/bpython/bpython.git","ssh_url":"git@github.com:bpython/bpython.git","clone_url":"https://github.com/bpython/bpython.git","svn_url":"https://github.com/bpython/bpython","homepage":"http://bpython-interpreter.org/","size":8381,"stargazers_count":280,"watchers_count":280,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":56,"mirror_url":null,"open_issues_count":84,"forks":56,"open_issues":84,"watchers":280,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bpython/bpython/pulls/589"},"html":{"href":"https://github.com/bpython/bpython/pull/589"},"issue":{"href":"https://api.github.com/repos/bpython/bpython/issues/589"},"comments":{"href":"https://api.github.com/repos/bpython/bpython/issues/589/comments"},"review_comments":{"href":"https://api.github.com/repos/bpython/bpython/pulls/589/comments"},"review_comment":{"href":"https://api.github.com/repos/bpython/bpython/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bpython/bpython/pulls/589/commits"},"statuses":{"href":"https://api.github.com/repos/bpython/bpython/statuses/2a8bf7ec798def794f31b17aca7993da3c12d08e"}}}}