projects
/
pygdb.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
added an install info
[pygdb.git]
/
DbgTerminal.py
diff --git
a/DbgTerminal.py
b/DbgTerminal.py
index 543cadc893144bc0c378bb2cd4e09be082f9b76a..0f0eb07f77a4ded1a1917f0e37965c1b6656234c 100644
(file)
--- a/
DbgTerminal.py
+++ b/
DbgTerminal.py
@@
-28,6
+28,7
@@
class DbgTerminal (vte.Terminal):
self.childpid = None
self.history = [""]
self.isactive = True
self.childpid = None
self.history = [""]
self.isactive = True
+ self.lastc, self.lastr = 0,0
#Start debugger
self.clientCmd = clientCmd
#Start debugger
self.clientCmd = clientCmd
@@
-61,7
+62,8
@@
class DbgTerminal (vte.Terminal):
assert( self.getHistoryLen()>0 )
c,r = term.get_cursor_position()
assert( self.getHistoryLen()>0 )
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(self.lastr,self.lastc,r,c-1,lambda *w:True)
+ self.lastc, self.lastr = c,r
#Remove annoying \n at the end
assert(text[-1] == "\n")
#Remove annoying \n at the end
assert(text[-1] == "\n")
@@
-70,13
+72,14
@@
class DbgTerminal (vte.Terminal):
#Get the lines and remove empty lines
lines = string.split(text, "\n")
#Get the lines and remove empty lines
lines = string.split(text, "\n")
+
#Remove the incomplete line
#Remove the incomplete line
- del self.history[-1]
- #Add lines to history. The last line contains no "\n" at the end!
- self.history += [l+"\n" for l in lines[:-1]]
- self.history += [lines[-1]]
+ len = self.getHistoryLen()
+ self.history[-1] += lines[0]
+ self.history += lines[1:]
- assert(r == self.getHistoryLen()-1)
+ for l in self.history[len:]:
+ pass
def waitForNewline(self):
def waitForNewline(self):
@@
-88,16
+91,16
@@
class DbgTerminal (vte.Terminal):
return len(self.history)
def waitForRx(self, rx, start):
return len(self.history)
def waitForRx(self, rx, start):
-
curr = start
curr = start
-
while True:
while True:
- for no in range(max(curr-1,start), self.getHistoryLen()):
+ assert( curr>=start )
+ for no in range(curr, self.getHistoryLen()):
line = self.history[no]
if rx.search(line):
return no, line
line = self.history[no]
if rx.search(line):
return no, line
- curr = max(start,self.getHistoryLen())
+ #Do not forget the last line
+ curr = max(start,self.getHistoryLen()-1)
gtk.main_iteration()
gtk.main_iteration()