Skip to main content

Terminal Scrollbar - Dual Mode Architecture

MonoTerm’s scrollbar provides two distinct modes optimized for different use cases: reading output and following live streams.
┌─────────────────────────────────────────────────────────────────┐
│  SCROLLBAR MODE SELECTION                                       │
├─────────────────────────────────────────────────────────────────┤
│                                                                 │
│   [ Focus Mode  ]  Click to switch                              │
│     │                                                           │
│     ├── Focus Mode       Default, protects reading              │
│     └── Auto-scroll      Follows live output                    │
│                                                                 │
│   Keyboard: Cmd+Shift+R (toggle between modes)                  │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘

Mode Comparison

┌─────────────────────────────────────────────────────────────────┐
│  FOCUS MODE vs AUTO-SCROLL                                      │
├─────────────────────────────────────────────────────────────────┤
│                                                                 │
│                     Focus Mode         Auto-scroll              │
│                     ──────────         ───────────              │
│                                                                 │
│   Best For          Reading output     Following logs           │
│                                                                 │
│   After Scroll      3 sec protection   Immediate resume         │
│                                                                 │
│   Mouse Hover       Blocks scrolling   No effect                │
│                                                                 │
│   Recovery          Return to anchor   Return to bottom         │
│                                                                 │
│   Complexity        Smart detection    Simple tracking          │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘

Focus Mode

Focus Mode protects your reading experience with intelligent detection.
┌─────────────────────────────────────────────────────────────────┐
│  FOCUS MODE PROTECTION                                          │
├─────────────────────────────────────────────────────────────────┤
│                                                                 │
│   Protection Trigger 1: User Scroll                             │
│   ───────────────────────────────────                           │
│                                                                 │
│   User scrolls up                                               │
│       │                                                         │
│       ▼                                                         │
│   ┌─────────────────┐                                           │
│   │  Save Position  │  Remember where you scrolled to           │
│   └────────┬────────┘                                           │
│            │                                                    │
│            ▼                                                    │
│   ┌─────────────────┐                                           │
│   │  3 Second Timer │  Protection active                        │
│   │     [|||      ] │  No auto-scroll during this time          │
│   └────────┬────────┘                                           │
│            │                                                    │
│            ▼                                                    │
│   ┌─────────────────┐                                           │
│   │  Timer Expires  │  Auto-scroll can resume                   │
│   │  (if at bottom) │                                           │
│   └─────────────────┘                                           │
│                                                                 │
│   ═══════════════════════════════════════════════════════════   │
│                                                                 │
│   Protection Trigger 2: Mouse Hover                             │
│   ────────────────────────────────────                          │
│                                                                 │
│   Mouse enters terminal                                         │
│       │                                                         │
│       ▼                                                         │
│   ┌─────────────────┐                                           │
│   │ Hover Detected  │  "User is reading"                        │
│   │                 │  Block all auto-scroll                    │
│   └────────┬────────┘                                           │
│            │                                                    │
│   Mouse leaves terminal                                         │
│            │                                                    │
│            ▼                                                    │
│   ┌─────────────────┐                                           │
│   │  Resume Normal  │  Auto-scroll can work again               │
│   └─────────────────┘                                           │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘

Auto-Scroll Mode

Auto-scroll mode simply follows output to the bottom.
┌─────────────────────────────────────────────────────────────────┐
│  AUTO-SCROLL LOGIC                                              │
├─────────────────────────────────────────────────────────────────┤
│                                                                 │
│   Simple State Machine:                                         │
│                                                                 │
│   ┌─────────────────────────────────────────────────────────┐   │
│   │                                                         │   │
│   │   Was at bottom before resize?                          │   │
│   │       │                                                 │   │
│   │       ├── YES:  New output arrives                      │   │
│   │       │         Scroll to bottom (follow)               │   │
│   │       │                                                 │   │
│   │       └── NO:   New output arrives                      │   │
│   │                 Stay in place (maintain position)       │   │
│   │                                                         │   │
│   └─────────────────────────────────────────────────────────┘   │
│                                                                 │
│   That's it! No protection, no timers, just follow.             │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘

Scroll Recovery Flow

Both modes handle unexpected scroll events gracefully.
┌─────────────────────────────────────────────────────────────────┐
│  SCROLL RECOVERY FLOW                                           │
├─────────────────────────────────────────────────────────────────┤
│                                                                 │
│   Start                                                         │
│     │                                                           │
│     ▼                                                           │
│   ┌─────────────────────────────────────────────────────────┐   │
│   │  Focus Mode Protection Check                            │   │
│   │                                                         │   │
│   │  Time since scroll < 3 seconds?  Stop                   │   │
│   │  Mouse hovering terminal?        Stop                   │   │
│   └──────────────────────┬──────────────────────────────────┘   │
│                          │                                      │
│                          ▼  Continue                            │
│   ┌─────────────────────────────────────────────────────────┐   │
│   │  Phase 1: Top Jump Detection                            │   │
│   │                                                         │   │
│   │  Scroll position near top (< 100px)?                    │   │
│   │    │                                                    │   │
│   │    ├── Focus Mode:   Return to saved anchor position    │   │
│   │    │                                                    │   │
│   │    └── Auto-scroll:  Return to bottom                   │   │
│   │                                                         │   │
│   └──────────────────────┬──────────────────────────────────┘   │
│                          │                                      │
│                          ▼  Normal scroll                       │
│   ┌─────────────────────────────────────────────────────────┐   │
│   │  Phase 2: Normal Reflow                                 │   │
│   │                                                         │   │
│   │  Was at bottom before resize?                           │   │
│   │    │                                                    │   │
│   │    └── YES:  Scroll to bottom                           │   │
│   │                                                         │   │
│   └─────────────────────────────────────────────────────────┘   │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘

Use Case Examples

┌─────────────────────────────────────────────────────────────────┐
│  WHEN TO USE EACH MODE                                          │
├─────────────────────────────────────────────────────────────────┤
│                                                                 │
│   Live Log Monitoring (Auto-scroll)                             │
│   ─────────────────────────────────                             │
│   ┌─────────────────────────────────────────────────────────┐   │
│   │                                                         │   │
│   │  Server logs streaming...                               │   │
│   │  New log entry appears                                  │   │
│   │  Screen automatically follows                           │   │
│   │                                                         │   │
│   │  You see the latest output                              │   │
│   │                                                         │   │
│   └─────────────────────────────────────────────────────────┘   │
│                                                                 │
│   ═══════════════════════════════════════════════════════════   │
│                                                                 │
│   Reading Error Output (Focus Mode)                             │
│   ─────────────────────────────────                             │
│   ┌─────────────────────────────────────────────────────────┐   │
│   │                                                         │   │
│   │  1. Error appears, you scroll up to read it             │   │
│   │                                                         │   │
│   │  2. New output arrives...                               │   │
│   │     (3 second protection active)                        │   │
│   │     Screen stays where you are reading                  │   │
│   │                                                         │   │
│   │  3. Mouse hovers over terminal                          │   │
│   │     (hover protection active)                           │   │
│   │     Screen stays stable                                 │   │
│   │                                                         │   │
│   │  4. You finish reading, move mouse away                 │   │
│   │     After 3 seconds, auto-scroll resumes                │   │
│   │                                                         │   │
│   └─────────────────────────────────────────────────────────┘   │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘

Summary

┌─────────────────────────────────────────────────────────────────┐
│  SCROLLBAR IN ONE PICTURE                                       │
├─────────────────────────────────────────────────────────────────┤
│                                                                 │
│   User Intent Detection                                         │
│       │                                                         │
│       ├── Scrolling up           "Reading something"            │
│       │                          Protect position               │
│       │                                                         │
│       ├── Mouse hovering         "Still reading"                │
│       │                          Keep protection                │
│       │                                                         │
│       └── At bottom, no hover    "Following output"             │
│                                  Auto-scroll active             │
│                                                                 │
│   ═══════════════════════════════════════════════════════════   │
│                                                                 │
│   Design Principles:                                            │
│                                                                 │
│   SMPC (Simplicity):                                            │
│   ┌─────────────────────────────────────────────────────────┐   │
│   │  Two modes, each with clear responsibility              │   │
│   │  Auto-scroll: simple bottom tracking                    │   │
│   │  Focus: reading protection                              │   │
│   └─────────────────────────────────────────────────────────┘   │
│                                                                 │
│   OFAC (Order from Chaos):                                      │
│   ┌─────────────────────────────────────────────────────────┐   │
│   │  User intent inference (scroll = reading)               │   │
│   │  Mouse hover = reading intent                           │   │
│   │  3 second timeout = natural recovery                    │   │
│   └─────────────────────────────────────────────────────────┘   │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘