{"action":"created","issue":{"url":"https://api.github.com/repos/bpython/bpython/issues/448","labels_url":"https://api.github.com/repos/bpython/bpython/issues/448/labels{/name}","comments_url":"https://api.github.com/repos/bpython/bpython/issues/448/comments","events_url":"https://api.github.com/repos/bpython/bpython/issues/448/events","html_url":"https://github.com/bpython/bpython/issues/448","id":54668104,"number":448,"title":"Crash on multiline rewind of line containing opening and closing parens","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},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-01-17T17:20:59Z","updated_at":"2015-01-17T17:26:38Z","closed_at":null,"body":"\r\n~~~.py\r\n>>> for line in f:\r\n...        a() |\r\nTraceback (most recent call last):\r\n  File \"/Users/tomb/.virtualenvs/bpython/bin/bpython\", line 9, in <module>\r\n    load_entry_point('bpython==0.13-363', 'console_scripts', 'bpython')()\r\n  File \"/Users/tomb/Dropbox/code/bpython/bpython/curtsies.py\", line 69, in main\r\n    mainloop(config, locals_, banner, interp, paste, interactive=(not exec_args))\r\n  File \"/Users/tomb/Dropbox/code/bpython/bpython/curtsies.py\", line 147, in mainloop\r\n    process_event(e)\r\n  File \"/Users/tomb/Dropbox/code/bpython/bpython/curtsies.py\", line 126, in process_event\r\n    repl.process_event(e)\r\n  File \"/Users/tomb/Dropbox/code/bpython/bpython/curtsiesfrontend/repl.py\", line 436, in process_event\r\n    return self.process_key_event(e)\r\n  File \"/Users/tomb/Dropbox/code/bpython/bpython/curtsiesfrontend/repl.py\", line 540, in process_key_event\r\n    self.undo()\r\n  File \"/Users/tomb/Dropbox/code/bpython/bpython/repl.py\", line 802, in undo\r\n    self.take_back_buffer_line()\r\n  File \"/Users/tomb/Dropbox/code/bpython/bpython/curtsiesfrontend/repl.py\", line 1276, in take_back_buffer_line\r\n    self._set_cursor_offset(0, update_completion=False)\r\n  File \"/Users/tomb/Dropbox/code/bpython/bpython/curtsiesfrontend/repl.py\", line 1246, in _set_cursor_offset\r\n    self.unhighlight_paren()\r\n  File \"/Users/tomb/Dropbox/code/bpython/bpython/curtsiesfrontend/repl.py\", line 887, in unhighlight_paren\r\n    self.display_buffer[lineno] = self.display_buffer[lineno].setslice_with_length(0, len(new), new, len(self.display_buffer[lineno]))\r\nIndexError: list index out of range\r\n~~~\r\nwhere | is the cursor."},"comment":{"url":"https://api.github.com/repos/bpython/bpython/issues/comments/70375342","html_url":"https://github.com/bpython/bpython/issues/448#issuecomment-70375342","issue_url":"https://api.github.com/repos/bpython/bpython/issues/448","id":70375342,"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},"created_at":"2015-01-17T17:26:38Z","updated_at":"2015-01-17T17:26:38Z","body":"It seems like this could be fixed by simultaneously changing cursor_offset and current_line - or cleverly changing them in an order than makes sense. The former is probably more sustainable, maybe making these both properties was a bad idea in the first place.\r\n\r\n`set_line_and_cursor` maybe, or `set_line_with_cursor`"}}