#NEWLINE# def insert_text_result( self , text ) : #NEWLINE# #INDENT# '\n        Return result of insert_text(text) without actually performing the\n        insertion.  Handy for pre-validation.\n\n        :param text: text for inserting, type (bytes or unicode)\n                     must match the text in the caption\n        :type text: bytes or unicode\n        ' #NEWLINE# text = self . _normalize_to_caption ( text ) #NEWLINE# if self . highlight : #NEWLINE# #INDENT# ( start , stop ) = self . highlight #NEWLINE# ( btext , etext ) = ( self . edit_text [ : start ] , self . edit_text [ stop : ] ) #NEWLINE# result_text = ( btext + result_text ) #NEWLINE# result_pos = start #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# result_text = self . edit_text #NEWLINE# result_pos = self . edit_pos #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# result_text = ( ( result_text [ : result_pos ] + text ) + result_text [ result_pos : ] ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# assert 0 , repr ( ( self . edit_text , result_text , text ) ) #NEWLINE# #UNINDENT# result_pos += len ( text ) #NEWLINE# return ( result_text , result_pos )