Earlier quoted context omitted.
As I understand it, they do exactly what you say. TFA is about optimizing the last chunk's loop.
Maybe I got confused, but how do they then count the newlines in all the previous chunks? That information is still needed to calculate the line for a specific position in the last chunk
It's outlined in their previous post on the Rope/SumTree data structure they use, which this article links to: https://zed.dev/blog/zed-decoded-rope-sumtree.