diff options
author | Phil Hughes <me@iamphill.com> | 2016-11-29 16:40:03 +0000 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2016-11-30 10:52:48 +0000 |
commit | 34053a49703613d08bab7010a970b0ea8096ebad (patch) | |
tree | 6e5435658cb46439d6421bc9fe980bb22643c934 /app/assets/javascripts/gfm_auto_complete.js.es6 | |
parent | 50a410a977877dd44b1eaa078974c3a11ffd7475 (diff) | |
download | gitlab-ce-34053a49703613d08bab7010a970b0ea8096ebad.tar.gz |
Fixed GFM autocomplete regexautocomplete-stays-open
Without this fix it is possible that the autocomplete popup will stay open with the very first match, no matter if there is a match further in the string.
Closes #25119
Diffstat (limited to 'app/assets/javascripts/gfm_auto_complete.js.es6')
-rw-r--r-- | app/assets/javascripts/gfm_auto_complete.js.es6 | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/app/assets/javascripts/gfm_auto_complete.js.es6 b/app/assets/javascripts/gfm_auto_complete.js.es6 index 89fe13b7a45..10769b7fd4f 100644 --- a/app/assets/javascripts/gfm_auto_complete.js.es6 +++ b/app/assets/javascripts/gfm_auto_complete.js.es6 @@ -59,12 +59,13 @@ // Tweaked to commands to start without a space only if char before is a non-word character // https://github.com/ichord/At.js var _a, _y, regexp, match; + subtext = subtext.split(' ').pop(); flag = flag.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); _a = decodeURI("%C3%80"); _y = decodeURI("%C3%BF"); - regexp = new RegExp("(?:\\B|\\W|\\s)" + flag + "([A-Za-z" + _a + "-" + _y + "0-9_\'\.\+\-]*)|([^\\x00-\\xff]*)$", 'gi'); + regexp = new RegExp("(?:\\B|\\W|\\s)" + flag + "(?!\\W)([A-Za-z" + _a + "-" + _y + "0-9_\'\.\+\-]*)|([^\\x00-\\xff]*)$", 'gi'); match = regexp.exec(subtext); |