Smooth, Flicker-Free Terminal
Ever noticed your terminal flickering during fast output? Monolex completely eliminates this problem with a technology called Atomic State.Copy
╔═══════════════════════════════════════════════════════════════════════════════╗
║ ║
║ NO MORE FLICKER ║
║ ║
║ Before Monolex After Monolex ║
║ ┌─────────────┐ ┌─────────────┐ ║
║ │ ▓░▓░▓░▓░▓░ │ │ Hello World │ ║
║ │ FLICKER! │ → │ Smooth text │ ║
║ │ ░▓░▓░▓░▓░▓ │ │ Always clean│ ║
║ └─────────────┘ └─────────────┘ ║
║ ║
╚═══════════════════════════════════════════════════════════════════════════════╝
The Problem: Why Terminals Flicker
When programs print text really fast, traditional terminals struggle to keep up:Copy
┌─────────────────────────────────────────────────────────────────┐
│ TRADITIONAL TERMINAL │
├─────────────────────────────────────────────────────────────────┤
│ │
│ Program says: "Print Hello World" │
│ │
│ Step 1: "H" arrives → Show immediately │
│ Step 2: "e" arrives → Show immediately │
│ Step 3: "l" arrives → Show immediately │
│ Step 4: "l" arrives → Show immediately │
│ Step 5: "o" arrives → Show immediately │
│ ...and so on │
│ │
│ Problem: Screen updates 11 times for "Hello World"! │
│ │
│ Your eyes see: │
│ ┌───────────────────────────────────────────┐ │
│ │ H → He → Hel → Hell → Hello → Hello W... │ │
│ └───────────────────────────────────────────┘ │
│ │
│ Result: FLICKER, JITTER, EYE STRAIN │
│ │
└─────────────────────────────────────────────────────────────────┘
The Solution: Atomic State
Monolex waits for complete frames before showing anything:Copy
┌─────────────────────────────────────────────────────────────────┐
│ MONOLEX WITH ATOMIC STATE │
├─────────────────────────────────────────────────────────────────┤
│ │
│ Program says: "Print Hello World" │
│ │
│ ┌─────────────────┐ │
│ │ WAITING ROOM │ ← Characters wait here │
│ │ ───────────── │ │
│ │ H e l l o │ │
│ │ W o r l d │ │
│ └────────┬────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────┐ │
│ │ QUALITY CHECK │ ← Is the frame complete? │
│ │ ───────────── │ │
│ │ ✓ All text │ │
│ │ ✓ All colors │ │
│ │ ✓ Cursor pos │ │
│ └────────┬────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────┐ │
│ │ YOUR SCREEN │ ← Show only when ready! │
│ │ ───────────── │ │
│ │ Hello World │ │
│ └─────────────────┘ │
│ │
│ Result: ONE clean update, NO flicker │
│ │
└─────────────────────────────────────────────────────────────────┘
Think of it like a movie theater: Instead of showing you each frame as it’s being drawn, Monolex waits until the entire scene is ready, then displays it perfectly.
How It Works: The Gatekeeper
Copy
┌─────────────────────────────────────────────────────────────────┐
│ │
│ THE GATEKEEPER CONCEPT │
│ │
│ Programs Gatekeeper Your Screen │
│ ───────── ────────── ─────────── │
│ │
│ ┌───────┐ ┌────────┐ ┌───────────┐ │
│ │ App 1 │────────▶│ │ │ │ │
│ └───────┘ │ │ │ Perfect │ │
│ │ ATOMIC │──────────▶│ Display │ │
│ ┌───────┐ │ STATE │ │ │ │
│ │ App 2 │────────▶│ │ │ Always │ │
│ └───────┘ │ │ │ Clean │ │
│ └────────┘ │ │ │
│ ┌───────┐ │ └───────────┘ │
│ │ App 3 │──────────────┘ │
│ └───────┘ │
│ │
│ The Gatekeeper: │
│ • Collects all incoming data │
│ • Checks if frame is complete │
│ • Only lets perfect frames through │
│ │
└─────────────────────────────────────────────────────────────────┘
Visual Comparison
Traditional Terminal
Copy
Time 0ms: |H___________|
Time 1ms: |He__________|
Time 2ms: |Hel_________|
Time 3ms: |Hell________|
Time 4ms: |Hello_______|
Time 5ms: |Hello ______|
Time 6ms: |Hello W_____|
Time 7ms: |Hello Wo____|
Time 8ms: |Hello Wor___|
Time 9ms: |Hello Worl__|
Time 10ms: |Hello World_|
11 screen updates = FLICKER
Monolex
Copy
Time 0ms: |___________|
(waiting...)
(waiting...)
(waiting...)
(waiting...)
(waiting...)
(waiting...)
(waiting...)
(waiting...)
(waiting...)
Time 10ms: |Hello World|
1 screen update = SMOOTH
Smart Detection (4 Patterns)
Monolex uses the Alacritty VTE Parser (the same parser used by the popular Alacritty terminal) to understand terminal output. It detects 4 specific patterns to know when a frame is complete:Copy
┌─────────────────────────────────────────────────────────────────┐
│ PATTERN DETECTION (4 MECHANISMS) │
├─────────────────────────────────────────────────────────────────┤
│ │
│ Pattern 1: BSU/ESU (Synchronized Update Protocol) │
│ ───────────────────────────────────────────────── │
│ │
│ Modern programs send explicit signals: │
│ "BEGIN UPDATE" → draw content → "END UPDATE" │
│ │
│ Monolex waits for "END UPDATE" before displaying! │
│ │
├─────────────────────────────────────────────────────────────────┤
│ │
│ Pattern 2: CURSOR HIDE/SHOW (Ink Pattern) │
│ ───────────────────────────────────────────────── │
│ │
│ Programs often: │
│ 1. Hide cursor ← "I'm about to draw" │
│ 2. Draw content │
│ 3. Show cursor ← "I'm done drawing" │
│ │
│ Monolex detects this and waits for step 3! │
│ │
├─────────────────────────────────────────────────────────────────┤
│ │
│ Pattern 3: SCREEN CLEAR (Implicit Sync) │
│ ───────────────────────────────────────────────── │
│ │
│ When screen clears: │
│ • Old content gone │
│ • New content definitely coming │
│ • Wait 8ms for complete frame before showing │
│ │
├─────────────────────────────────────────────────────────────────┤
│ │
│ Pattern 4: INCOMPLETE SEQUENCE │
│ ───────────────────────────────────────────────── │
│ │
│ If a command is split across packets: │
│ Packet 1: "Set color to re" │
│ Packet 2: "d" (rest of "red") │
│ │
│ Monolex buffers until the command is complete! │
│ │
└─────────────────────────────────────────────────────────────────┘
Real-World Examples
Example 1: Running a Build Command
Copy
┌─────────────────────────────────────────────────────────────────┐
│ npm run build │
├─────────────────────────────────────────────────────────────────┤
│ │
│ Without Atomic State: With Atomic State: │
│ ───────────────────── ────────────────── │
│ │
│ [==== ] 40% [==== ] 40% │
│ [===== ] 50% (smooth transition) │
│ [====== ] 60% [==========] 100% │
│ [======= ] 70% │
│ [======== ] 80% Progress bar updates │
│ [========= ] 90% cleanly, no jitter │
│ [==========] 100% │
│ │
│ Each % causes redraw Only meaningful updates shown │
│ │
└─────────────────────────────────────────────────────────────────┘
Example 2: AI Streaming Output
Copy
┌─────────────────────────────────────────────────────────────────┐
│ Claude Code generating response │
├─────────────────────────────────────────────────────────────────┤
│ │
│ Without Atomic State: With Atomic State: │
│ ───────────────────── ────────────────── │
│ │
│ T (waiting...) │
│ Th │
│ The │
│ The The answer is 42. │
│ The a │
│ The an Smooth, complete sentences │
│ The ans appear at natural pauses │
│ The answ │
│ The answe │
│ The answer │
│ ... │
│ │
│ Every character flickers Text appears in readable chunks │
│ │
└─────────────────────────────────────────────────────────────────┘
Example 3: Vim/Neovim Editing
Copy
┌─────────────────────────────────────────────────────────────────┐
│ Opening a file in Vim │
├─────────────────────────────────────────────────────────────────┤
│ │
│ Without Atomic State: With Atomic State: │
│ ───────────────────── ────────────────── │
│ │
│ ┌────────────────────┐ ┌────────────────────┐ │
│ │ │ │ │ │
│ │ partial line 1 │ │ complete file │ │
│ │ par │ → │ with syntax │ │
│ │ ░░░░░ (loading) │ │ highlighting │ │
│ │ │ │ ready instantly │ │
│ └────────────────────┘ └────────────────────┘ │
│ │
│ You see the file being File appears complete │
│ drawn line by line with all colors │
│ │
└─────────────────────────────────────────────────────────────────┘
The Result
No Flicker
Your eyes will thank you. No more visual noise or jitter.
Less CPU
Fewer screen updates means your computer works less hard.
Better Battery
Less processing means longer battery life on laptops.
Summary
Copy
╔═══════════════════════════════════════════════════════════════════════════════╗
║ ║
║ ATOMIC STATE IN ONE PICTURE ║
║ ║
║ ┌─────────┐ ┌──────────────┐ ┌─────────────┐ ┌─────────┐ ║
║ │Programs │ ───▶ │ Waiting │ ───▶ │ Quality │ ───▶ │ Your │ ║
║ │ output │ │ Room │ │ Check │ │ Screen │ ║
║ │ data │ │ (buffer) │ │ (is ready?)│ │(perfect)│ ║
║ └─────────┘ └──────────────┘ └─────────────┘ └─────────┘ ║
║ ║
║ Fast, messy Collected, Only complete Clean, ║
║ data stream organized frames pass smooth ║
║ ║
╚═══════════════════════════════════════════════════════════════════════════════╝
You don’t need to do anything! Atomic State works automatically in Monolex. Just enjoy the smooth experience.