Tuchkata / styles-highlighter

Styles highlighter plugin for the Atom text editor.
MIT License
3 stars 1 forks source link

Uncaught SyntaxError: Invalid regular expression: /or(1/: Unterminated group #12

Open valvo27 opened 4 years ago

valvo27 commented 4 years ago

[Enter steps to reproduce:]

  1. Select any text that has parenthesis or any Regex symbol.
  2. Highlight the text.

It appears styles-highlighter doesn't escape literal characters and treats [()|.* as regex characters causing the below errror. If its a | it hangs the entire console.

Atom: 1.41.0 x64 Electron: 4.2.7 OS: Mac OS X 10.15.1 Thrown From: styles-highlighter package 2.4.0

Stack Trace

Uncaught SyntaxError: Invalid regular expression: /or(1/: Unterminated group

At /Users/jovalver/.atom/packages/styles-highlighter/lib/styles-highlighter.coffee:85

SyntaxError: Invalid regular expression: /or(1/: Unterminated group
    at new RegExp (<anonymous>)
    at Object.markSelection (/packages/styles-highlighter/lib/styles-highlighter.coffee:85:31)
    at Object.markFirstStyle (/packages/styles-highlighter/lib/styles-highlighter.coffee:102:6)
    at /packages/styles-highlighter/lib/styles-highlighter.coffee:32:101)
    at CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:349392)
    at KeymapManager.dispatchCommandEvent (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:1252536)
    at KeymapManager.handleKeyboardEvent (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:1248670)
    at WindowEventHandler.handleDocumentKeyEvent (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:284598)

Commands

     -0:06.7.0 core:paste (input.hidden-input)
     -0:01.3.0 styles-highlighter:markFirstStyle (input.hidden-input)

Non-Core Packages

atom-panda-syntax 0.18.0 
find-list 0.3.0 
minimap 4.29.9 
styles-highlighter 2.4.0