From 39b0176026cd8bda24158a04308df4679e19dcaf Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 28 Jan 2020 21:24:51 +0000 Subject: fix(fun/wcl): Count words correctly if file starts with whitespace --- fun/wcl/wc.lisp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'fun') diff --git a/fun/wcl/wc.lisp b/fun/wcl/wc.lisp index f443125a85..a3d5cd1206 100644 --- a/fun/wcl/wc.lisp +++ b/fun/wcl/wc.lisp @@ -21,9 +21,10 @@ (counting is-newline into newlines) ;; Count every "word", unless the preceding character already - ;; was a space. + ;; was a space or we are at the beginning of the file. (when (or (eq space previous-byte) - (eq newline previous-byte)) + (eq newline previous-byte) + (not previous-byte)) (next-iteration)) (counting (or is-newline (eq space byte)) -- cgit 1.4.1