From d3db636b4c00893c857d228b91a28d7c85c4e7b4 2018-04-02 09:17:52 From: Thomas Kluyver Date: 2018-04-02 09:17:52 Subject: [PATCH] Allow offset 0 in position_to_cursor Closes gh-11029 --- diff --git a/IPython/core/completer.py b/IPython/core/completer.py index c84a586..cee7833 100644 --- a/IPython/core/completer.py +++ b/IPython/core/completer.py @@ -869,7 +869,7 @@ def position_to_cursor(text:str, offset:int)->Tuple[int, int]: """ - assert 0 < offset <= len(text) , "0 < %s <= %s" % (offset , len(text)) + assert 0 <= offset <= len(text) , "0 <= %s <= %s" % (offset , len(text)) before = text[:offset] blines = before.split('\n') # ! splitnes trim trailing \n