From 770d0d8956cd5f55bb61069a743225a28818c134 Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Sat, 10 Jan 2015 09:26:53 +0300 Subject: [PATCH 1/1] Work around http://debbugs.gnu.org/19553 Fixes #274 --- company.el | 3 ++- test/frontends-tests.el | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/company.el b/company.el index b71b0f3e5..e4cfcdde3 100644 --- a/company.el +++ b/company.el @@ -2220,7 +2220,8 @@ If SHOW-VERSION is non-nil, show the version in the echo area." (defun company-buffer-lines (beg end) (goto-char beg) (let (lines lines-moved) - (while (and (> (setq lines-moved (vertical-motion 1)) 0) + (while (and (not (eobp)) ; http://debbugs.gnu.org/19553 + (> (setq lines-moved (vertical-motion 1)) 0) (<= (point) end)) (let ((bound (min end (1- (point))))) ;; A visual line can contain several physical lines (e.g. with outline's diff --git a/test/frontends-tests.el b/test/frontends-tests.el index 1d12b3c68..a10f91461 100644 --- a/test/frontends-tests.el +++ b/test/frontends-tests.el @@ -267,6 +267,15 @@ (should (equal (company-buffer-lines (point-min) (point-max)) '("" "" "" "eee" "fff" "ggg"))))) +(ert-deftest company-buffer-lines-with-multiline-after-string-at-eob () + :tags '(interactive) + (with-temp-buffer + (insert "a\nb\nc\n") + (let ((ov (make-overlay (point-max) (point-max) nil t t))) + (overlay-put ov 'after-string "~\n~\n~")) + (should (equal (company-buffer-lines (point-min) (point-max)) + '("a" "b" "c"))))) + (ert-deftest company-modify-line () (let ((str "-*-foobar")) (should (equal-including-properties -- 2.39.2