diff options
-rw-r--r-- | pygments/lexers/shell.py | 4 | ||||
-rw-r--r-- | tests/examplefiles/example.sh-session | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/pygments/lexers/shell.py b/pygments/lexers/shell.py index df45317e..b6afa353 100644 --- a/pygments/lexers/shell.py +++ b/pygments/lexers/shell.py @@ -122,8 +122,8 @@ class BashSessionLexer(Lexer): for match in line_re.finditer(text): line = match.group() - 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 diff --git a/tests/examplefiles/example.sh-session b/tests/examplefiles/example.sh-session index 35b81ebb..02f3bb0d 100644 --- a/tests/examplefiles/example.sh-session +++ b/tests/examplefiles/example.sh-session @@ -15,3 +15,5 @@ user@host:~/path$ su root@host:~# sh-3.1$ # on hardy sh$ # on etch +(virtualenv-name)user@host:~$ ls -a + |