diff options
author | Thierry Volpiatto <thierry.volpiatto@gmail.com> | 2017-08-25 20:17:56 +0200 |
---|---|---|
committer | Thierry Volpiatto <thierry.volpiatto@gmail.com> | 2017-08-25 20:17:56 +0200 |
commit | a11ce55dd4e2faf3ee66ebd731670d15cb0a1bd8 (patch) | |
tree | ed3c9229c39080b39df529c3ca6c5b3dfa02db3f /helm-dabbrev.el | |
parent | 618607a4a65cc1915d57106455dfb45e36839b70 (diff) |
Fix matching dabbrev at bol
* helm-dabbrev.el (helm-dabbrev-separator-regexp): Fix regexp.
(helm--dabbrev--search): when going back one char the eol to limit
search is at the next line when separator is bol.
Diffstat (limited to 'helm-dabbrev.el')
-rw-r--r-- | helm-dabbrev.el | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/helm-dabbrev.el b/helm-dabbrev.el index d1fdd52a..19a5481b 100644 --- a/helm-dabbrev.el +++ b/helm-dabbrev.el @@ -101,7 +101,7 @@ but the initial search for all candidates in buffer(s)." (const :tag "Respect case" nil) (other :tag "Smart" 'smart))) -(defvar helm-dabbrev-separator-regexp "\\s-\\|\t\\|[(\[\{\"'`=<$;,@.#+]\\|\\s\\\\|^" +(defvar helm-dabbrev-separator-regexp "^\n\\|\\s-\\|\t\\|[(\[\{\"'`=<$;,@.#+]\\|\\s\\" "Regexp matching the start of a dabbrev candidate.") (defvaralias 'helm-dabbrev--regexp 'helm-dabbrev-separator-regexp) (make-obsolete-variable 'helm-dabbrev--regexp 'helm-dabbrev-separator-regexp "2.8.3") @@ -191,19 +191,20 @@ but the initial search for all candidates in buffer(s)." finally return (nreverse result)))) (defun helm--dabbrev--search (pattern beg sep-regexp) - (save-excursion - (goto-char (1- beg)) - (when (re-search-forward - (concat "\\(" - helm-dabbrev-separator-regexp - "\\)" - "\\(?99:\\(" - (regexp-quote pattern) - "\\(\\sw\\|\\s_\\)+\\)\\)") - (point-at-eol) t) - (replace-regexp-in-string - sep-regexp "" - (match-string-no-properties 99))))) + (let ((eol (point-at-eol))) + (save-excursion + (goto-char (1- beg)) + (when (re-search-forward + (concat "\\(" + helm-dabbrev-separator-regexp + "\\)" + "\\(?99:\\(" + (regexp-quote pattern) + "\\(\\sw\\|\\s_\\)+\\)\\)") + eol t) + (replace-regexp-in-string + sep-regexp "" + (match-string-no-properties 99)))))) (defun helm-dabbrev--get-candidates (abbrev) (cl-assert abbrev nil "[No Match]") |