clang-format: Separate line-merging logic into its own class.

No functional changes (intended).