Katkat

Implement Terminal Tabs and Split Panels

WarpSoftware Engineer · Technical Screen

Last updated

This question evaluates the ability to design and implement hierarchical data structures, model tree-based panel layouts, and perform precise serialization/deserialization of nested UI state.

Implement a data structure that models a terminal application with multiple tabs and split panels.

Requirements:

  • A Terminal can create and store multiple tabs.
  • Each Tab contains a panel layout.
  • A Panel can be split into child panels, similar to how terminal panes can be split horizontally or vertically.
  • Model the panel layout as a tree, where each split creates child panel nodes.
  • Implement methods to:
  • Create a new tab.
  • Split an existing panel inside a tab.
  • Serialize the full terminal state, including all tabs and nested panel layouts.
  • Deserialize the serialized state back into an equivalent Terminal object.
  • The serialization format should preserve all nesting levels and split information exactly.
  • Write at least one test case that creates tabs, performs nested panel splits, serializes the terminal, deserializes it, and verifies that the reconstructed structure matches the original.