projects
/
pygdb.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
d7679b0
)
simplify DbgTerminal.contents_changed
author
Stefan Huber <shuber2@gmail.com>
Tue, 10 Jun 2008 14:39:26 +0000
(16:39 +0200)
committer
Stefan Huber <shuber2@gmail.com>
Tue, 10 Jun 2008 14:39:26 +0000
(16:39 +0200)
DbgTerminal.py
patch
|
blob
|
history
diff --git
a/DbgTerminal.py
b/DbgTerminal.py
index b9eb0d6ea3efc4b8a04ca5b698a5128bafaf5546..543cadc893144bc0c378bb2cd4e09be082f9b76a 100644
(file)
--- a/
DbgTerminal.py
+++ b/
DbgTerminal.py
@@
-26,7
+26,7
@@
class DbgTerminal (vte.Terminal):
#Set members
self.childpid = None
#Set members
self.childpid = None
- self.history = []
+ self.history = [
""
]
self.isactive = True
#Start debugger
self.isactive = True
#Start debugger
@@
-58,20
+58,20
@@
class DbgTerminal (vte.Terminal):
def contents_changed(self, term):
def contents_changed(self, term):
+ assert( self.getHistoryLen()>0 )
+
c,r = term.get_cursor_position()
c,r = term.get_cursor_position()
- text = self.get_text_range(
max(self.getHistoryLen()-1,0)
,0,r,-1,lambda *w:True)
+ text = self.get_text_range(
self.getHistoryLen()-1
,0,r,-1,lambda *w:True)
#Remove annoying \n at the end
assert(text[-1] == "\n")
text = text[:-1]
#Remove annoying \n at the end
assert(text[-1] == "\n")
text = text[:-1]
- #Remove the incomplete line
- if self.getHistoryLen()>0 and self.history[-1]!='\n':
- del self.history[-1]
-
#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
+ 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]]
#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]]