Project
RxTerm
A C++ library for functional-reactive terminals — lean ANSI-powered UI without ncurses.
C++14BuckBazelANSI Escape Sequences
What is RxTerm?
RxTerm is a header-only C++ library for building terminal UIs using functional-reactive principles. It renders rich, animated output entirely via ANSI escape sequences — no ncurses, no platform-specific console API.

How it works
RxTerm models terminal output as a pure function of state. On each update it:
- Computes the new screen as a string of ANSI-annotated characters
- Diffs it against the previous frame
- Writes only the changed cells using
ESC[row;colHcursor positioning andESC[2Kline clearing
This is exactly the technique covered in the Terminal Escape Sequences slides — cursor positioning, line clearing, and colour codes working together to create smooth in-place animation.
Core API
#include <rxterm/terminal.hpp>
#include <rxterm/style.hpp>
#include <rxterm/components/text.hpp>
#include <rxterm/components/stacklayout.hpp>
using namespace rxterm;
auto render(VirtualTerminal vt, int i) {
return vt.flip(
StackLayout<>{
Text("Hello, " + std::to_string(i) + "!", Style{ Color::Green }),
}
);
}
int main() {
auto vt = VirtualTerminal{};
for (int i = 0; i < 100; ++i) {
vt = render(vt, i);
std::this_thread::sleep_for(std::chrono::milliseconds(30));
}
}Features
- ✅ ANSI colour output (16-color + 256-color)
- ✅ Reusable components (
Text,StackLayout, …) - ✅ Functional / immutable update model
- ⬜ Managed console input
- ⬜ Terminal width detection
- ⬜ Full Windows support (works in msys2/mingw/cygwin)
Building
Requires C++14 and either Buck or Bazel:
buckaroo install
buck run :main # or: bazel run :main