James Polley (Atlassian) committed ae79ad7

Extend the parsing of Generic.Prompt when lexing a shell session to support the case where the shell is running inside a virtualenv

In this case, prompts look like this:


Comments (0)

Files changed (2)


         for match in line_re.finditer(text):
             line =
-            m = re.match(r'^((?:|sh\S*?|\w+\S+[@:]\S+(?:\s+\S+)?|\[\S+[@:]'
-                         r'[^\n]+\].+)[$#%])(.*\n?)', line)
+            m = re.match(r'^((?:\(\S+\))?(?:|sh\S*?|\w+\S+[@:]\S+(?:\s+\S+)'
+                          r'?|\[\S+[@:][^\n]+\].+)[$#%])(.*\n?)' , line)
             if m:
                 # To support output lexers (say diff output), the output
                 # needs to be broken by prompts whenever the output lexer


 sh-3.1$ # on hardy
 sh$ # on etch
+(virtualenv-name)user@host:~$ ls -a