emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master 6e88174 053/173: Don't cut off the last character from a w


From: Dmitry Gutov
Subject: [elpa] master 6e88174 053/173: Don't cut off the last character from a wrapped line
Date: Thu, 23 Jun 2016 00:28:37 +0000 (UTC)

branch: master
commit 6e88174dae252d2fc1605ed84cb7252fd37ab98f
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>

    Don't cut off the last character from a wrapped line
    
    Reported by Eli Zaretskii at
    http://debbugs.gnu.org/cgi/bugreport.cgi?bug=20847#68
---
 company.el              |    2 +-
 test/frontends-tests.el |   12 +++++++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/company.el b/company.el
index f0b1f1d..5c20c05 100644
--- a/company.el
+++ b/company.el
@@ -2350,7 +2350,7 @@ If SHOW-VERSION is non-nil, show the version in the echo 
area."
     (while (and (not (eobp)) ; http://debbugs.gnu.org/19553
                 (> (setq lines-moved (vertical-motion 1)) 0)
                 (<= (point) end))
-      (let ((bound (min end (1- (point)))))
+      (let ((bound (min end (point))))
         ;; A visual line can contain several physical lines (e.g. with 
outline's
         ;; folding overlay).  Take only the first one.
         (push (buffer-substring beg
diff --git a/test/frontends-tests.el b/test/frontends-tests.el
index 613856e..63f881e 100644
--- a/test/frontends-tests.el
+++ b/test/frontends-tests.el
@@ -299,7 +299,7 @@
     (insert (propertize "a" 'display "bbb\nccc\ndddd\n"))
     (insert "eee\nfff\nggg")
     (should (equal (company-buffer-lines (point-min) (point-max))
-                   '("" "" "" "eee" "fff" "ggg")))))
+                   '("a" "" "" "eee" "fff" "ggg")))))
 
 (ert-deftest company-buffer-lines-with-multiline-after-string-at-eob ()
   :tags '(interactive)
@@ -310,6 +310,16 @@
     (should (equal (company-buffer-lines (point-min) (point-max))
                    '("a" "b" "c")))))
 
+(ert-deftest company-buffer-lines-with-line-wrapping ()
+  :tags '(interactive)
+  (with-temp-buffer
+    (let ((ww (company--window-width)))
+      (insert (make-string (* 3 ww) ?a))
+      (should (equal (company-buffer-lines (point-min) (point-max))
+                     (list (make-string ww ?a)
+                           (make-string ww ?a)
+                           (make-string ww ?a)))))))
+
 (ert-deftest company-modify-line ()
   (let ((str "-*-foobar"))
     (should (equal-including-properties



reply via email to

[Prev in Thread] Current Thread [Next in Thread]