]> git.sthu.org Git - pygdb.git/commitdiff
fixing bug, when getting text from terminal: started at line -1
authorStefan Huber <shuber2@gmail.com>
Tue, 10 Jun 2008 11:47:22 +0000 (13:47 +0200)
committerStefan Huber <shuber2@gmail.com>
Tue, 10 Jun 2008 11:47:22 +0000 (13:47 +0200)
DbgTerminal.py

index 11eaf5c35ee2cdf4a7f2629716b69fe5f2394e85..e9a706fffcdb793ba81e7d3d027ef48d010d1c39 100644 (file)
@@ -59,7 +59,7 @@ class DbgTerminal (vte.Terminal):
 
        def contents_changed(self, term):
                c,r = term.get_cursor_position()
-               text = self.get_text_range(self.getHistoryLen()-1,0,r,-1,lambda *w:True)
+               text = self.get_text_range(max(self.getHistoryLen()-1,0),0,r,-1,lambda *w:True)
 
                #Remove annoying \n at the end
                assert(text[-1] == "\n")
@@ -76,6 +76,8 @@ class DbgTerminal (vte.Terminal):
                self.history += [l+"\n" for l in lines[:-1]]
                self.history += [lines[-1]]
 
+               assert(r == self.getHistoryLen()-1)
+
 
        def waitForNewline(self):
                l = self.getHistoryLen()