Skip to content

Warp an high-performance terminal built in Rust.

Posted on:February 24, 2024 at 05:05 PM

Warp is an innovative high-performance terminal built entirely in Rust, designed to enhance user productivity and simplify the command-line interface (CLI) experience. What sets Warp apart is its command editor, which functions as a full-fledged text editor, allowing selections, cursor positioning, and shortcuts akin to those in other applications. Commands and their outputs are visually grouped into blocks, and existing shortcuts like the up arrow and ctrl-r have been enhanced with new visual menus to make them more user-friendly.

In this article, we delve into how the foundation of Warp was built, covering the user interface, blocks, and the input editor. This foundation not only facilitates current operations but also lays the groundwork for exciting upcoming features such as infinite history, real-time collaboration, and shared environment variables.

The development of Warp involved making conscious decisions at every level of the technological stack. Initially, key requirements were established:

  1. Speed: Crucial for a terminal, Warp is designed to run at 60 fps, even on high-resolution monitors like 4K or 8K.
  2. Compatibility with Existing Shells: Ensures seamless operation with popular shells like Bash, ZSH, and Fish, maintaining existing keybindings.
  3. Multiplatform, including Web Support: Designed to run on various platforms, including the ability to render Warp in a browser for real-time collaboration.
  4. Integration with Shells to Support Blocks (including over SSH): To enable features like blocks, Warp deeply integrates with the current running session in the shell.
  5. Arbitrary UI Elements: Unlike traditional terminals, Warp can render diverse UI elements, such as snackbars and overflow menus, to make the terminal more accessible and functional.
  6. Native and Intuitive Editing: Includes a full text editor for intuitive editing, with features like text selection and cursor positioning familiar to users of modern applications.

Rust and Metal were chosen as the technological foundation for Warp, prioritizing speed. By focusing on rendering directly on the GPU using Metal, potential performance bottlenecks found in terminals based on Electron were overcome.

Rendering on the GPU with Metal presents its own challenges, but Warp has focused on primarily rendering rectangles, images, and glyphs, significantly reducing complexity. While UI framework options for Rust were explored, the lack of stability led to the decision to build a custom UI framework in collaboration with Nathan Sobo, co-founder of Atom. This framework is used to build an element tree for the application, which can be rendered using various engines (currently only Metal, with plans to add OpenGL and WebGL to support more platforms).

In summary, Warp is not just a high-performance terminal; it represents an innovative solution addressing specific challenges to enhance the user experience in the command-line environment. Its design and underlying technology reflect careful attention to speed, compatibility, and expandability for future features.