##// END OF EJS Templates
runlines adds commented lines to raw history now
vivainio -
Show More
@@ -6,7 +6,7 b' Requires Python 2.3 or newer.'
6
6
7 This file contains all the classes and helper functions specific to IPython.
7 This file contains all the classes and helper functions specific to IPython.
8
8
9 $Id: iplib.py 2463 2007-06-27 22:51:16Z vivainio $
9 $Id: iplib.py 2571 2007-08-01 14:48:03Z vivainio $
10 """
10 """
11
11
12 #*****************************************************************************
12 #*****************************************************************************
@@ -1786,7 +1786,6 b' want to merge them back into the new files.""" % locals()'
1786 self.indent_current_nsp -= 4
1786 self.indent_current_nsp -= 4
1787 else:
1787 else:
1788 self.indent_current_nsp = 0
1788 self.indent_current_nsp = 0
1789
1790 def runlines(self,lines):
1789 def runlines(self,lines):
1791 """Run a string of one or more lines of source.
1790 """Run a string of one or more lines of source.
1792
1791
@@ -1800,11 +1799,16 b' want to merge them back into the new files.""" % locals()'
1800 self.resetbuffer()
1799 self.resetbuffer()
1801 lines = lines.split('\n')
1800 lines = lines.split('\n')
1802 more = 0
1801 more = 0
1802
1803 for line in lines:
1803 for line in lines:
1804 # skip blank lines so we don't mess up the prompt counter, but do
1804 # skip blank lines so we don't mess up the prompt counter, but do
1805 # NOT skip even a blank line if we are in a code block (more is
1805 # NOT skip even a blank line if we are in a code block (more is
1806 # true)
1806 # true)
1807
1808
1807 if line or more:
1809 if line or more:
1810 # push to raw history, so hist line numbers stay in sync
1811 self.input_hist_raw.append("# " + line + "\n")
1808 more = self.push(self.prefilter(line,more))
1812 more = self.push(self.prefilter(line,more))
1809 # IPython's runsource returns None if there was an error
1813 # IPython's runsource returns None if there was an error
1810 # compiling the code. This allows us to stop processing right
1814 # compiling the code. This allows us to stop processing right
General Comments 0
You need to be logged in to leave comments. Login now