Pulsar-Edit-Highlights / selected

@Pulsar-Edit package for highlighting occurrences of your selection.
https://web.pulsar-edit.dev/packages/highlight-selected
MIT License
248 stars 67 forks source link

Uncaught TypeError: Cannot read property '0' of null #217

Open Hugo1974 opened 4 years ago

Hugo1974 commented 4 years ago

Error when there is an empty selection. The selection is made from left to right.

Thrown From: multi-highlight-selected package 2.0.0

Stack Trace

Uncaught TypeError: Cannot read property '0' of null

At highlighted-area-view.coffee:102

96 # Highlights everything that belongs to one color (ie, all instances of the 97 # first word, make red) 98 highLightOneSelection: (text, i) -> 99 editor = @getActiveEditor() 100 regex = new RegExp("\S\w\b", 'gi') 101 result = regex.exec(text) 102 regexSearch = result[0]

103 return unless result? 104 return if result[0].length < atom.config.get( 105 'highlight-selected.minimumLength') or 106 result.index isnt 0 or 107 result[0] isnt result.input

TypeError: Cannot read property '0' of null at HighlightedAreaView.module.exports.HighlightedAreaView.highLightOneSelection (/packages/multi-highlight-selected/lib/highlighted-area-view.coffee:102:26) at HighlightedAreaView.module.exports.HighlightedAreaView.handleSelection (/packages/multi-highlight-selected/lib/highlighted-area-view.coffee:93:8) at HighlightedAreaView.handleSelection (/packages/multi-highlight-selected/lib/highlighted-area-view.coffee:1:1) at /packages/multi-highlight-selected/lib/highlighted-area-view.coffee:48:8


### Commands

4x -8:06.5.0 editor:move-line-up (input.hidden-input) -8:03.6.0 core:move-left (input.hidden-input) -8:02.7.0 editor:select-to-beginning-of-word (input.hidden-input) -8:00.0 autocomplete-plus:confirm (input.hidden-input) 4x -7:59 core:save (input.hidden-input) -7:41.5.0 core:move-right (input.hidden-input) -7:40.8.0 core:move-left (input.hidden-input) 3x -7:37 core:save (input.hidden-input) 29x -7:14.7.0 core:undo (input.hidden-input) 2x -7:12.9.0 core:save (input.hidden-input) -5:56.5.0 core:delete (div.github-StagingView.staged-changes-focused) -4:46.2.0 window:run-package-specs (atom-pane.pane) -4:19.8.0 atom-beautify:open-settings (atom-pane.pane) -2:47.7.0 core:save (button.btn.icon.enablement.icon-playback-play) -1:47.8.0 grammar-selector:show (atom-text-editor.editor.is-focused) -1:46.1.0 core:confirm (input.hidden-input)

ThorsenRune commented 3 years ago

Any workaround? Got that error "Uncaught TypeError: Cannot read property '0' of null" too.