(self, head, tail, chars, lines)
Replace the text between the given indices.

        Args:
            head: Starting index of text to replace.
            tail: Ending index of text to replace.
            chars: Expected to be string of current text
                between head and tail.
            lines: List of new lines to insert between head
                and tail.
Replace the text between the given indices.
Replace the text between the given indices .
def set_region(self, head, tail, chars, lines):
        """Replace the text between the given indices.

        Args:
            head: Starting index of text to replace.
            tail: Ending index of text to replace.
            chars: Expected to be string of current text
                between head and tail.
            lines: List of new lines to insert between head
                and tail.
        """
        text = self.editwin.text
        newchars = "\n".join(lines)
        if newchars == chars:
            text.bell()
            return
        text.tag_remove("sel", "1.0", "end")
        text.mark_set("insert", head)
        text.undo_block_start()
        text.delete(head, tail)
        text.insert(head, newchars)
        text.undo_block_stop()
        text.tag_add("sel", head, "insert")
def set_region ( self , head , tail , chars , lines ) : text = self . editwin . text newchars = "\n" . join ( lines ) if newchars == chars : text . bell ( ) return text . tag_remove ( "sel" , "1.0" , "end" ) text . mark_set ( "insert" , head ) text . undo_block_start ( ) text . delete ( head , tail ) text . insert ( head , newchars ) text . undo_block_stop ( ) text . tag_add ( "sel" , head , "insert" )