#NEWLINE# def set_edit_pos( self , pos ) : #NEWLINE# #INDENT# '\n        Set the cursor position with a self.edit_text offset.\n        Clips pos to [0, len(edit_text)].\n\n        :param pos: cursor position\n        :type pos: int\n\n        >>> e = Edit(u"", u"word")\n        >>> e.edit_pos\n        4\n        >>> e.set_edit_pos(2)\n        >>> e.edit_pos\n        2\n        >>> e.edit_pos = -1  # Urwid 0.9.9 or later\n        >>> e.edit_pos\n        0\n        >>> e.edit_pos = 20\n        >>> e.edit_pos\n        4\n        ' #NEWLINE# if ( pos < 0 ) : #NEWLINE# #INDENT# pos = 0 #NEWLINE# #UNINDENT# if ( pos > len ( pos . _edit_text ) ) : #NEWLINE# #INDENT# pos = len ( self . _edit_text ) #NEWLINE# #UNINDENT# self . highlight = None #NEWLINE# self . pref_col_maxcol = ( None , None ) #NEWLINE# self . _edit_pos = pos #NEWLINE# self . _invalidate ( )