Commit 4a797620 authored by Phil Hughes's avatar Phil Hughes

Added comments to regex

parent eb993dc5
...@@ -91,6 +91,7 @@ ...@@ -91,6 +91,7 @@
inputValue = inputValue.replace(/"(.*?)"/g, str => str.replace(/\s/g, '_') ); inputValue = inputValue.replace(/"(.*?)"/g, str => str.replace(/\s/g, '_') );
// Get the right position for the word selected // Get the right position for the word selected
// Regex matches first space
let right = inputValue.slice(selectionStart).search(/\s/); let right = inputValue.slice(selectionStart).search(/\s/);
if (right >= 0) { if (right >= 0) {
...@@ -100,6 +101,7 @@ ...@@ -100,6 +101,7 @@
} }
// Get the left position for the word selected // Get the left position for the word selected
// Regex matches last non-whitespace character
let left = inputValue.slice(0, right).search(/\S+$/); let left = inputValue.slice(0, right).search(/\S+$/);
if (selectionStart === 0) { if (selectionStart === 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment