# std.Progress: count newlines more accurately · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/dc3a192ae841706bb965218c68b0085bbec2b35e)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: dc3a192ae841706bb965218c68b0085bbec2b35e

Requested commit: dc3a192ae841706bb965218c68b0085bbec2b35e

Commit: dc3a192ae841706bb965218c68b0085bbec2b35e

Tree: 24aa6cca1ca96e9ceeedc528942c55ab372fcc5a

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
std.Progress: count newlines more accurately

Split newline_count into written_newline_count and
accumulated_newline_count. This handle the case when the tryLock() fails
to obtain the lock, because in such case there would not be any newlines
written to the terminal but the system would incorrectly think there
were. Now, written_newline_count is only adjusted when the write() call
succeeds.

Furthermore, write() call failure is handled by exiting the update
thread.

```

## Parents

- [6145819c0ba00924b37bab78200aeab6306c1672](https://git.cafe/gitcafe/zig/commit/6145819c0ba00924b37bab78200aeab6306c1672?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/dc3a192ae841706bb965218c68b0085bbec2b35e?format=markdown)
