Improve code block overflow handling and padding