From 2ccdf9d7016943d4b1b8da3213478b67d25fe5f9 Mon Sep 17 00:00:00 2001 From: Wigginns <3180645+Wigginns@users.noreply.github.com> Date: Thu, 26 Oct 2017 16:22:06 -0600 Subject: [PATCH 1/2] Add special case for Perl `$` `%` and `@` variables Perl uses symbols to denote variable types. Adding them to the special cases on the regex search. --- lib/highlighted-area-view.coffee | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/highlighted-area-view.coffee b/lib/highlighted-area-view.coffee index 1585b8e..a71f5ef 100644 --- a/lib/highlighted-area-view.coffee +++ b/lib/highlighted-area-view.coffee @@ -124,8 +124,14 @@ class HighlightedAreaView if atom.config.get('highlight-selected.onlyHighlightWholeWords') if regexSearch.indexOf("\$") isnt -1 \ - and editor.getGrammar()?.name in ['PHP', 'HACK'] + and editor.getGrammar()?.name in ['PHP', 'HACK', 'Perl'] regexSearch = regexSearch.replace("\$", "\$\\b") + else if regexSearch.indexOf("\%") isnt -1 \ + and editor.getGrammar()?.name in ['Perl'] + regexSearch = regexSearch.replace("\%", "\%\\b") + else if regexSearch.indexOf("\@") isnt -1 \ + and editor.getGrammar()?.name in ['Perl'] + regexSearch = regexSearch.replace("\@", "\@\\b") else regexSearch = "\\b" + regexSearch regexSearch = regexSearch + "\\b" From ac90294cda19749aecdfe30235f466ca12a21dc0 Mon Sep 17 00:00:00 2001 From: Wigginns <3180645+Wigginns@users.noreply.github.com> Date: Thu, 26 Oct 2017 17:21:09 -0600 Subject: [PATCH 2/2] Fix indent level on line #131 and #134 --- lib/highlighted-area-view.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/highlighted-area-view.coffee b/lib/highlighted-area-view.coffee index a71f5ef..4884c72 100644 --- a/lib/highlighted-area-view.coffee +++ b/lib/highlighted-area-view.coffee @@ -128,10 +128,10 @@ class HighlightedAreaView regexSearch = regexSearch.replace("\$", "\$\\b") else if regexSearch.indexOf("\%") isnt -1 \ and editor.getGrammar()?.name in ['Perl'] - regexSearch = regexSearch.replace("\%", "\%\\b") + regexSearch = regexSearch.replace("\%", "\%\\b") else if regexSearch.indexOf("\@") isnt -1 \ and editor.getGrammar()?.name in ['Perl'] - regexSearch = regexSearch.replace("\@", "\@\\b") + regexSearch = regexSearch.replace("\@", "\@\\b") else regexSearch = "\\b" + regexSearch regexSearch = regexSearch + "\\b"