- if self.lastrow < r:
- text = self.get_text_range(self.lastrow,0,r-1,-1,lambda *w:True)
- self.history += string.split(text, "\n")
+ if self.lastrow <= r:
+ text = self.get_text_range(self.lastrow,0,r,-1,lambda *w:True)
+
+ #Remove the incomplete line
+ if self.getHistoryLen()>0 and (len(self.history[-1])==0 or self.history[-1]!='\n') :
+ del self.history[-1]
+
+ #Get the lines and remove empty lines
+ lines = string.split(text, "\n")
+
+ #Remove last empty line...
+ if lines[-1] == "":
+ del lines[-1]
+
+ #Add lines to history
+ self.history += [l+"\n" for l in lines[:-1]]
+ self.history += [lines[-1]]