(self)
Insert a new line at the cursor. Wrap text from the cursor to the
        end of the line to the next line. If the line is a single line, saves
        and exits.
Insert a new line at the cursor. Wrap text from the cursor to the
        end of the line to the next line. If the line is a single line, saves
        and exits.
Insert a new line at the cursor . Wrap text from the cursor to the end of the line to the next line . If the line is a single line saves and exits .
def insert_line_or_quit(self):
        """Insert a new line at the cursor. Wrap text from the cursor to the
        end of the line to the next line. If the line is a single line, saves
        and exits.

        """
        if self.max_text_size == 1:
            # Save and quit for single-line entries
            return False
        if len(self.text) == self.max_text_size:
            return
        line = list(self.text[self.buffer_idx_y])
        newline = line[self.cur_pos_x:]
        line = line[:self.cur_pos_x]
        self.text[self.buffer_idx_y] = "".join(line)
        self.text.insert(self.buffer_idx_y + 1, "".join(newline))
        self.buffer_rows = max(self.win_size_y, len(self.text))
        self.cur_pos_x = 0
        self.down()
def insert_line_or_quit ( self ) : if self . max_text_size == 1 : # Save and quit for single-line entries return False if len ( self . text ) == self . max_text_size : return line = list ( self . text [ self . buffer_idx_y ] ) newline = line [ self . cur_pos_x : ] line = line [ : self . cur_pos_x ] self . text [ self . buffer_idx_y ] = "" . join ( line ) self . text . insert ( self . buffer_idx_y + 1 , "" . join ( newline ) ) self . buffer_rows = max ( self . win_size_y , len ( self . text ) ) self . cur_pos_x = 0 self . down ( )