environment/lib/python2.7/site-packages/IPython/frontend/terminal/interactiveshell.py
def _replace_rlhist_multiline(self, source_raw, hlen_before_cell):
        """Store multiple lines as a single entry in history"""

        # do nothing without readline or disabled multiline
        if not self.has_readline or not self.multiline_history:
            return hlen_before_cell

        # windows rl has no remove_history_item
        if not hasattr(self.readline, "remove_history_item"):
            return hlen_before_cell

        # skip empty cells
        if not source_raw.rstrip():
            return hlen_before_cell

        # nothing changed do nothing, e.g. when rl removes consecutive dups
        hlen = self.readline.get_current_history_length()
        if hlen == hlen_before_cell:
            return hlen_before_cell

        for i in range(hlen - hlen_before_cell):
            self.readline.remove_history_item(hlen - i - 1)
        stdin_encoding = get_stream_enc(sys.stdin, 'utf-8')
        self.readline.add_history(py3compat.unicode_to_str(source_raw.rstrip(),
                                    stdin_encoding))
        return self.readline.get_current_history_length()
def _replace_rlhist_multiline(self, source_raw, hlen_before_cell):
        """Store multiple lines as a single entry in history"""

        # do nothing without readline or disabled multiline
        if not self.has_readline or not self.multiline_history:
            return hlen_before_cell

        # windows rl has no remove_history_item
        if not hasattr(self.readline, "remove_history_item"):
            return hlen_before_cell

        # skip empty cells
        if not source_raw.rstrip():
            return hlen_before_cell

        # nothing changed do nothing, e.g. when rl removes consecutive dups
        hlen = self.readline.get_current_history_length()
        if hlen == hlen_before_cell:
            return hlen_before_cell

        for i in range(hlen - hlen_before_cell):
            self.readline.remove_history_item(hlen - i - 1)
        stdin_encoding = get_stream_enc(sys.stdin, 'utf-8')
        self.readline.add_history(py3compat.unicode_to_str(source_raw.rstrip(),
                                    stdin_encoding))
        return self.readline.get_current_history_length()
def _replace_rlhist_multiline ( self , source_raw , hlen_before_cell ) : # do nothing without readline or disabled multiline if not self . has_readline or not self . multiline_history : return hlen_before_cell # windows rl has no remove_history_item if not hasattr ( self . readline , "remove_history_item" ) : return hlen_before_cell # skip empty cells if not source_raw . rstrip ( ) : return hlen_before_cell # nothing changed do nothing, e.g. when rl removes consecutive dups hlen = self . readline . get_current_history_length ( ) if hlen == hlen_before_cell : return hlen_before_cell for i in range ( hlen - hlen_before_cell ) : self . readline . remove_history_item ( hlen - i - 1 ) stdin_encoding = get_stream_enc ( sys . stdin , 'utf-8' ) self . readline . add_history ( py3compat . unicode_to_str ( source_raw . rstrip ( ) , stdin_encoding ) ) return self . readline . get_current_history_length ( )
Store multiple lines as a single entry in history
Store multiple lines as a single entry in history