]> code.delx.au - gnu-emacs-elpa/commitdiff
Don't cut off the last character from a wrapped line
authorDmitry Gutov <dgutov@yandex.ru>
Tue, 23 Jun 2015 00:06:51 +0000 (03:06 +0300)
committerDmitry Gutov <dgutov@yandex.ru>
Tue, 23 Jun 2015 00:06:51 +0000 (03:06 +0300)
Reported by Eli Zaretskii at
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=20847#68

company.el
test/frontends-tests.el

index f0b1f1d7043d2ccddf1604badb0e9076f9c34e4f..5c20c0516be6e57acae8e3893576c8024be04667 100644 (file)
@@ -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
index 613856e57418c2a7ee298b5ed786f3a3e7343800..63f881e2e2368b982d1dee11af04e1982157ba96 100644 (file)
     (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)
     (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