Ratatui v0.30 will introduce block border merging, a feature that previously required manual handling.

You can now set the border merge strategy using Block’s new method: merge_borders

📚 From the docs:

use ratatui::symbols::merge::MergeStrategy;

// Given several blocks with plain borders (1)
Block::bordered();
// and other blocks with thick borders (2) which are rendered on top of the first
Block::bordered()
    .border_type(BorderType::Thick)
    .merge_borders(MergeStrategy::Exact);
┌───┐    ┌───┐  ┌───┲━━━┓┌───┐
│   │    │ 1 │  │   ┃   ┃│   │
│ 1 │    │ ┏━┿━┓│ 1 ┃ 2 ┃│ 1 │
│   │    │ ┃ │ ┃│   ┃   ┃│   │
└───╆━━━┓└─╂─┘ ┃└───┺━━━┛┢━━━┪
    ┃   ┃  ┃ 2 ┃         ┃   ┃
    ┃ 2 ┃  ┗━━━┛         ┃ 2 ┃
    ┃   ┃                ┃   ┃
    ┗━━━┛                ┗━━━┛

🙌 Acknowledgments

Big thanks to:

They helped make this feature a reality.

🔗 View the final PR: #1874
🔗 Original PR by @pauladam94: #1729
Lots of insightful discussion in both!


🧪 Merge Strategy Comparison

Below is a full comparison of the three MergeStrategy variants.

📘 For detailed behavior, refer to the API docs.

█      MergeStrategy::Replace      █       MergeStrategy::Exact       █       MergeStrategy::Fuzzy       █
█▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█
█  ┌───┐    ┌───┐  ┌───┏━━━┓┌───┐  █  ┌───┐    ┌───┐  ┌───┲━━━┓┌───┐  █  ┌───┐    ┌───┐  ┌───┲━━━┓┌───┐  █
█  │   │    │   │  │   ┃   ┃│   │  █  │   │    │   │  │   ┃   ┃│   │  █  │   │    │   │  │   ┃   ┃│   │  █
█  │   │    │ ┏━━━┓│   ┃   ┃│   │  █  │   │    │ ┏━┿━┓│   ┃   ┃│   │  █  │   │    │ ┏━┿━┓│   ┃   ┃│   │  █
█  │   │    │ ┃ │ ┃│   ┃   ┃│   │  █  │   │    │ ┃ │ ┃│   ┃   ┃│   │  █  │   │    │ ┃ │ ┃│   ┃   ┃│   │  █
█  └───┏━━━┓└─┃─┘ ┃└───┗━━━┛┏━━━┓  █  └───╆━━━┓└─╂─┘ ┃└───┺━━━┛┢━━━┪  █  └───╆━━━┓└─╂─┘ ┃└───┺━━━┛┢━━━┪  █
█      ┃   ┃  ┃   ┃         ┃   ┃  █      ┃   ┃  ┃   ┃         ┃   ┃  █      ┃   ┃  ┃   ┃         ┃   ┃  █
█      ┃   ┃  ┗━━━┛         ┃   ┃  █      ┃   ┃  ┗━━━┛         ┃   ┃  █      ┃   ┃  ┗━━━┛         ┃   ┃  █
█      ┃   ┃                ┃   ┃  █      ┃   ┃                ┃   ┃  █      ┃   ┃                ┃   ┃  █
█      ┗━━━┛                ┗━━━┛  █      ┗━━━┛                ┗━━━┛  █      ┗━━━┛                ┗━━━┛  █
█  ┌───┐    ┌───┐  ┌───╔═══╗┌───┐  █  ┌───┐    ┌───┐  ┌───╔═══╗┌───┐  █  ┌───┐    ┌───┐  ┌───╦═══╗┌───┐  █
█  │   │    │   │  │   ║   ║│   │  █  │   │    │   │  │   ║   ║│   │  █  │   │    │   │  │   ║   ║│   │  █
█  │   │    │ ╔═══╗│   ║   ║│   │  █  │   │    │ ╔═╪═╗│   ║   ║│   │  █  │   │    │ ╔═╪═╗│   ║   ║│   │  █
█  │   │    │ ║ │ ║│   ║   ║│   │  █  │   │    │ ║ │ ║│   ║   ║│   │  █  │   │    │ ║ │ ║│   ║   ║│   │  █
█  └───╔═══╗└─║─┘ ║└───╚═══╝╔═══╗  █  └───╔═══╗└─╫─┘ ║└───╚═══╝╔═══╗  █  └───╬═══╗└─╫─┘ ║└───╩═══╝╠═══╣  █
█      ║   ║  ║   ║         ║   ║  █      ║   ║  ║   ║         ║   ║  █      ║   ║  ║   ║         ║   ║  █
█      ║   ║  ╚═══╝         ║   ║  █      ║   ║  ╚═══╝         ║   ║  █      ║   ║  ╚═══╝         ║   ║  █
█      ║   ║                ║   ║  █      ║   ║                ║   ║  █      ║   ║                ║   ║  █
█      ╚═══╝                ╚═══╝  █      ╚═══╝                ╚═══╝  █      ╚═══╝                ╚═══╝  █
█  ┌───┐    ┌───┐  ┌───┌╌╌╌┐┌───┐  █  ┌───┐    ┌───┐  ┌───┬╌╌╌┐┌───┐  █  ┌───┐    ┌───┐  ┌───┬╌╌╌┐┌───┐  █
█  │   │    │   │  │   ╎   ╎│   │  █  │   │    │   │  │   ╎   ╎│   │  █  │   │    │   │  │   ╎   ╎│   │  █
█  │   │    │ ┌╌╌╌┐│   ╎   ╎│   │  █  │   │    │ ┌╌╌╌┐│   ╎   ╎│   │  █  │   │    │ ┌╌┼╌┐│   ╎   ╎│   │  █
█  │   │    │ ╎ │ ╎│   ╎   ╎│   │  █  │   │    │ ╎ │ ╎│   ╎   ╎│   │  █  │   │    │ ╎ │ ╎│   ╎   ╎│   │  █
█  └───┌╌╌╌┐└─╎─┘ ╎└───└╌╌╌┘┌╌╌╌┐  █  └───┼╌╌╌┐└─╎─┘ ╎└───┴╌╌╌┘├╌╌╌┤  █  └───┼╌╌╌┐└─┼─┘ ╎└───┴╌╌╌┘├╌╌╌┤  █
█      ╎   ╎  ╎   ╎         ╎   ╎  █      ╎   ╎  ╎   ╎         ╎   ╎  █      ╎   ╎  ╎   ╎         ╎   ╎  █
█      ╎   ╎  └╌╌╌┘         ╎   ╎  █      ╎   ╎  └╌╌╌┘         ╎   ╎  █      ╎   ╎  └╌╌╌┘         ╎   ╎  █
█      ╎   ╎                ╎   ╎  █      ╎   ╎                ╎   ╎  █      ╎   ╎                ╎   ╎  █
█      └╌╌╌┘                └╌╌╌┘  █      └╌╌╌┘                └╌╌╌┘  █      └╌╌╌┘                └╌╌╌┘  █
█▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█

📄 View full comparison:
border_merging.txt (gist)