remove ps1 search

remove ps1 search
pull/155/head
kelianchun 2016-03-24 13:02:02 +08:00
parent db72048c31
commit 6d329b130a
1 changed files with 7 additions and 5 deletions

View File

@ -303,6 +303,7 @@ class SshTty(Tty):
data = ''
input_str = ''
input_mode = False
vim_end_flag = False
try:
tty.setraw(sys.stdin.fileno())
tty.setcbreak(sys.stdin.fileno())
@ -363,12 +364,13 @@ class SshTty(Tty):
if input_str != x:
data += input_str
if self.vim_flag:
match = self.ps1_pattern.search(self.vim_data)
match = re.compile(r'\x1b\[\?1049', re.X).findall(self.vim_data)
if match:
if vim_end_flag or len(match) == 2:
self.vim_flag = False
data = self.deal_command(data)[0:200]
if len(data) > 0:
TtyLog(log=log, datetime=datetime.datetime.now(), cmd=data).save()
vim_end_flag = False
else:
vim_end_flag = True
else:
data = self.deal_command(data)[0:200]
if len(data) > 0: