diff --git a/connect.py b/connect.py index cf9be2e17fe2982b9553815c256ee2192795267e..1d147f25a79bf75af66b2cc92da68e149bfc5ead 100644 --- a/connect.py +++ b/connect.py @@ -83,7 +83,7 @@ class Tty(object): return False - def remove_obstruct_char(cmd_str): + def remove_obstruct_char(self, cmd_str): '''åˆ é™¤ä¸€äº›å¹²æ‰°çš„ç‰¹æ®Šç¬¦å·''' control_char = re.compile(r'\x07 | \x1b\[1P | \r ', re.X) cmd_str = control_char.sub('',cmd_str.strip()) @@ -93,7 +93,7 @@ class Tty(object): return cmd_str - def remove_control_char(result_command): + def remove_control_char(self, result_command): """ å¤„ç†æ—¥å¿—特殊å—符 """ @@ -107,10 +107,10 @@ class Tty(object): [\x80-\x9f] | (?:\x1b\]0.*) | \[.*@.*\][\$#] | (.*mysql>.*) #åŒ¹é… æ‰€æœ‰æŽ§åˆ¶å—符 """, re.X) result_command = control_char.sub('', result_command.strip()) - global VIM_FLAG - if not VIM_FLAG: + + if not self.vim_flag: if result_command.startswith('vi') or result_command.startswith('fg'): - VIM_FLAG = True + self.vim_flag = True return result_command.decode('utf8',"ignore") else: return ''