#NEWLINE# def move_cursor_to_coords( self , size , x , y ) : #NEWLINE# #INDENT# '\n        Set the cursor position with (x,y) coordinates.\n        Returns True if move succeeded, False otherwise.\n\n        >>> size = (10,)\n        >>> e = Edit("","edit\\ntext")\n        >>> e.move_cursor_to_coords(size, 5, 0)\n        True\n        >>> e.edit_pos\n        4\n        >>> e.move_cursor_to_coords(size, 5, 3)\n        False\n        >>> e.move_cursor_to_coords(size, 0, 1)\n        True\n        >>> e.edit_pos\n        5\n        ' #NEWLINE# ( maxcol , ) = size #NEWLINE# trans = self . get_line_translation ( maxcol ) #NEWLINE# ( top_x , top_y ) = self . position_coords ( maxcol , 0 ) #NEWLINE# if ( ( y < top_y ) or ( y >= len ( trans ) ) ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# pos = calc_pos ( self . get_text ( ) [ 0 ] , trans , x , y ) #NEWLINE# e_pos = ( pos - len ( self . caption ) ) #NEWLINE# if ( e_pos < 0 ) : #NEWLINE# #INDENT# e_pos = 0 #NEWLINE# #UNINDENT# if ( e_pos > len ( self . edit_text ) ) : #NEWLINE# #INDENT# e_pos = len ( self . edit_text ) #NEWLINE# #UNINDENT# self . edit_pos = e_pos #NEWLINE# self . pref_col_maxcol = ( x , maxcol ) #NEWLINE# self . _invalidate ( ) #NEWLINE# return True