修复tmux等会重复出现命令的bug

pull/167/head
liuzheng712 2016-03-23 17:05:02 +08:00
parent e743ae3dbe
commit 52d8825d95
1 changed files with 6 additions and 3 deletions

View File

@ -174,13 +174,12 @@ class TermLogRecorder(object):
self._stream.attach(self._screen) self._stream.attach(self._screen)
def _command(self): def _command(self):
self._commands = []
for i in self._screen.display: for i in self._screen.display:
if i.strip().__len__() > 0: if i.strip().__len__() > 0:
self._commands.append(i.strip()) self._commands.append(i.strip())
self._screen.reset() if not i.strip() == '':
if not self._commands[-1] == '':
self.CMD[str(time.time())] = self._commands[-1] self.CMD[str(time.time())] = self._commands[-1]
self._screen.reset()
def write(self, msg): def write(self, msg):
if self.recoder and (not self._in_vim): if self.recoder and (not self._in_vim):
@ -199,6 +198,10 @@ class TermLogRecorder(object):
self._screen.reset() self._screen.reset()
else: else:
self._command() self._command()
print "<<<<<<<<<<<<<<<<"
print self._commands
print self.CMD
print ">>>>>>>>>>>>>>>>"
self.log[str(time.time() - self.recoderStartTime)] = msg.decode('utf-8', 'replace') self.log[str(time.time() - self.recoderStartTime)] = msg.decode('utf-8', 'replace')
def show(self): def show(self):