about summary refs log tree commit diff
path: root/fun
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2020-01-28T21·24+0000
committerVincent Ambo <tazjin@google.com>2020-01-28T21·24+0000
commit39b0176026cd8bda24158a04308df4679e19dcaf (patch)
tree0becd8019e486bc6a6fb6a03389d2f6b6c3bc8d5 /fun
parent1ba3d1cf97b9f671c7e0572fad7c57d691e69444 (diff)
fix(fun/wcl): Count words correctly if file starts with whitespace r/470
Diffstat (limited to 'fun')
-rw-r--r--fun/wcl/wc.lisp5
1 files changed, 3 insertions, 2 deletions
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))