Skip to content

enh(shell) allow period in prompt match (#4244) #4245

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Core Grammars:
- fix(ex) adds support for `?'` char literal and missing `defguardp` keyword [Kevin Bloch][]
- fix(diff) fix unified diff hunk header regex to allow unpaired numbers [Chris Wilson][]
- enh(php) support single line and hash comments in attributes, constructor and functions [Antoine Musso][]
- enh(shell) match period (.) as part of shell prompt [Ian Wienand][]

CONTRIBUTORS

Expand All @@ -23,6 +24,7 @@ CONTRIBUTORS
[Chris Wilson]: https://github.com/sushicw
[Antoine Musso]: https://github.com/hashar
[Chester Moses]: https://github.com/Chester-Moses-HCL
[Ian Wienand]: https://github.com/ianw


## Version 11.11.1
Expand Down
2 changes: 1 addition & 1 deletion src/languages/shell.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default function(hljs) {
// We cannot add \s (spaces) in the regular expression otherwise it will be too broad and produce unexpected result.
// For instance, in the following example, it would match "echo /path/to/home >" as a prompt:
// echo /path/to/home > t.exe
begin: /^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,
begin: /^\s{0,3}[./~\w\d[\]()@-]*[>%$#][ ]?/,
starts: {
end: /[^\\](?=\s*$)/,
subLanguage: 'bash'
Expand Down
1 change: 1 addition & 0 deletions test/markup/shell/prompt-with-period.expect.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<span class="hljs-meta prompt_">~/git-repo[branch-1.0]$ </span><span class="language-bash"><span class="hljs-built_in">ls</span> a.file</span>
1 change: 1 addition & 0 deletions test/markup/shell/prompt-with-period.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
~/git-repo[branch-1.0]$ ls a.file