diff: move diff stat drawing to a common function