[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master f3fd959: Fix count-lines problem in non-ASCII buffers
From: |
Lars Ingebrigtsen |
Subject: |
master f3fd959: Fix count-lines problem in non-ASCII buffers |
Date: |
Tue, 9 Feb 2021 02:12:22 -0500 (EST) |
branch: master
commit f3fd9591cfca5450b4bc74274340f24068f96fc7
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>
Fix count-lines problem in non-ASCII buffers
* src/fns.c (Fline_number_at_pos): Get the correct start position
in non-ASCII buffers (bug#22763).
---
src/fns.c | 2 +-
test/lisp/simple-tests.el | 5 +++++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/fns.c b/src/fns.c
index 02743c6..c16f9c6 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -5769,7 +5769,7 @@ visible part of the buffer. If ABSOLUTE is non-nil,
count the lines
from the absolute start of the buffer. */)
(register Lisp_Object position, Lisp_Object absolute)
{
- ptrdiff_t pos, start = BEGV;
+ ptrdiff_t pos, start = BEGV_BYTE;
if (MARKERP (position))
pos = marker_position (position);
diff --git a/test/lisp/simple-tests.el b/test/lisp/simple-tests.el
index b4007a6..f2ddc2e 100644
--- a/test/lisp/simple-tests.el
+++ b/test/lisp/simple-tests.el
@@ -67,6 +67,11 @@
(insert (propertize "\nbar\nbaz\nzut" 'invisible t))
(should (= (count-lines (point-min) (point-max) t) 2))))
+(ert-deftest simple-text-count-lines-non-ascii ()
+ (with-temp-buffer
+ (insert "あ\nい\nう\nえ\nお\n")
+ (should (= (count-lines (point) (point)) 0))))
+
;;; `transpose-sexps'
(defmacro simple-test--transpositions (&rest body)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master f3fd959: Fix count-lines problem in non-ASCII buffers,
Lars Ingebrigtsen <=