diff options
author | Vincent Ambo <tazjin@google.com> | 2020-01-28T21·24+0000 |
---|---|---|
committer | Vincent Ambo <tazjin@google.com> | 2020-01-28T21·24+0000 |
commit | 39b0176026cd8bda24158a04308df4679e19dcaf (patch) | |
tree | 0becd8019e486bc6a6fb6a03389d2f6b6c3bc8d5 /fun/wcl | |
parent | 1ba3d1cf97b9f671c7e0572fad7c57d691e69444 (diff) |
fix(fun/wcl): Count words correctly if file starts with whitespace r/470
Diffstat (limited to 'fun/wcl')
-rw-r--r-- | fun/wcl/wc.lisp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fun/wcl/wc.lisp b/fun/wcl/wc.lisp index f443125a85b4..a3d5cd120629 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)) |