[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master dae79c4 002/173: Merge branch 'search-hl-fix'
From: |
Dmitry Gutov |
Subject: |
[elpa] master dae79c4 002/173: Merge branch 'search-hl-fix' |
Date: |
Thu, 23 Jun 2016 00:28:33 +0000 (UTC) |
branch: master
commit dae79c4a43d60f160e5c794924037a77952fe71d
Merge: 22ecb92 3e70e12
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>
Merge branch 'search-hl-fix'
Conflicts:
company.el
---
company.el | 9 ++++++---
test/frontends-tests.el | 20 ++++++++++++++++++++
2 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/company.el b/company.el
index bcb5d53..99c7eb5 100644
--- a/company.el
+++ b/company.el
@@ -2231,9 +2231,12 @@ If SHOW-VERSION is non-nil, show the version in the echo
area."
(string-match (regexp-quote company-search-string) value
(length company-prefix)))
(let ((beg (+ margin (match-beginning 0)))
- (end (+ margin (match-end 0))))
- (add-text-properties beg end '(face company-tooltip-search)
- line))
+ (end (+ margin (match-end 0)))
+ (width (- width (length right))))
+ (when (< beg width)
+ (add-text-properties beg (min end width)
+ '(face company-tooltip-search)
+ line)))
(add-text-properties 0 width '(face company-tooltip-selection
mouse-face company-tooltip-selection)
line)
diff --git a/test/frontends-tests.el b/test/frontends-tests.el
index 35c94c9..613856e 100644
--- a/test/frontends-tests.el
+++ b/test/frontends-tests.el
@@ -245,6 +245,26 @@
" MIRAI発売2カ月 ")
(company--create-lines 0 999)))))
+(ert-deftest company-fill-propertize-truncates-search-highlight ()
+ (let ((company-search-string "foo")
+ (company-backend #'ignore)
+ (company-prefix ""))
+ (should (equal-including-properties
+ (company-fill-propertize "barfoo" nil 6 t nil nil)
+ #("barfoo"
+ 0 3 (face company-tooltip mouse-face company-tooltip-mouse)
+ 3 6 (face company-tooltip-search mouse-face
company-tooltip-mouse))))
+ (should (equal-including-properties
+ (company-fill-propertize "barfoo" nil 5 t "" " ")
+ #("barfo "
+ 0 3 (face company-tooltip mouse-face company-tooltip-mouse)
+ 3 5 (face company-tooltip-search mouse-face
company-tooltip-mouse)
+ 5 6 (face company-tooltip mouse-face company-tooltip-mouse))))
+ (should (equal-including-properties
+ (company-fill-propertize "barfoo" nil 3 t " " " ")
+ #(" bar "
+ 0 5 (face company-tooltip mouse-face company-tooltip-mouse))))))
+
(ert-deftest company-column-with-composition ()
:tags '(interactive)
(with-temp-buffer
- [elpa] master updated (24149b0 -> 7a2deff), Dmitry Gutov, 2016/06/22
- [elpa] master 448bcd8 007/173: company-show-doc-buffer: Bind other-window-scroll-buffer, Dmitry Gutov, 2016/06/22
- [elpa] master dae79c4 002/173: Merge branch 'search-hl-fix',
Dmitry Gutov <=
- [elpa] master 12f55f5 013/173: Buf was unused, Dmitry Gutov, 2016/06/22
- [elpa] master e94f2ec 008/173: company-show-doc-buffer: Still call doc-buffer inside the electric block, Dmitry Gutov, 2016/06/22
- [elpa] master 125a4da 009/173: company-show-location: Mirror the latest change to company-show-doc-buffer, Dmitry Gutov, 2016/06/22
- [elpa] master 7941f6e 010/173: company-diag: Include Emacs and Company versions, Dmitry Gutov, 2016/06/22
- [elpa] master 5733f2b 011/173: company-diag: Fix the annotation call, Dmitry Gutov, 2016/06/22
- [elpa] master af962d4 012/173: company-diag: Call `annotation' in the right buffer, Dmitry Gutov, 2016/06/22
- [elpa] master 5e107fd 015/173: Accept numeric argument in company-select-next and friends, Dmitry Gutov, 2016/06/22
- [elpa] master 479c676 021/173: Don't use `forward-symbol', apparently it's not in 24.3, Dmitry Gutov, 2016/06/22
- [elpa] master 41f4536 018/173: Add missing require to `company-gtags`, Dmitry Gutov, 2016/06/22
- [elpa] master b0f206a 020/173: Handle function pointers in annotation and template expansion, Dmitry Gutov, 2016/06/22