Support for max_str() via components

This is a cleaner implementation than before, with every component
knowing how to calculate its length.