No description
Find a file
m1ngsama d38cdf93b0 feat: Add complete persistent history system
Completed Phase 1 high priority task - comprehensive browsing history:

HistoryManager (New):
- JSON persistence to ~/.config/tut/history.json
- Auto-records every page visit
- Updates timestamp on revisit (moves to front)
- Limit to 1000 entries maximum
- Each entry stores: title, URL, timestamp
- Handles special characters with JSON escaping
- Auto-creates config directory if needed

UI Integration:
- History panel in bottom (center-left) of UI
- Shows up to 5 most recent visits
- Displays "[1] Title" format with cyan highlighting
- Shows "+N more..." indicator if >5 entries
- Real-time update on every navigation

Auto-Recording:
- Records on navigation via address bar
- Records on link click navigation
- Records on back/forward navigation
- Skips empty URLs and about:blank
- Updates existing entries instead of duplicating

Keyboard Shortcuts:
- F3: Toggle history panel visibility
  * Refreshes history list when opened

Features:
- Persistent storage across browser sessions
- Smart duplicate handling (updates timestamp)
- Move-to-front on revisit
- Automatic trimming to max 1000 entries
- Sorted display (newest first)
- Empty state handling ("(empty)" message)

Technical Implementation:
- HistoryManager class with Pimpl idiom
- Simple JSON format for easy manual editing
- Event-driven architecture (WindowEvent::OpenHistory)
- Lambda callback for history updates
- Integrated with navigation callbacks
- Three-panel bottom layout (Bookmarks | History | Status)

Storage Format:
[
  {"title": "Page Title", "url": "https://...", "timestamp": 1234567890},
  ...
]

Documentation:
- Updated KEYBOARD.md with F3 shortcut
- Updated STATUS.md to reflect completion
- Added history to interactive features list

All Phase 1 features now complete! 📚🎉
2026-01-01 18:07:08 +08:00
.github/workflows ci: Temporarily disable CI/CD during active development 2025-12-31 17:26:08 +08:00
assets feat: Complete FTXUI refactoring with clean architecture 2025-12-29 22:07:39 +08:00
cmake feat: Complete FTXUI refactoring with clean architecture 2025-12-29 22:07:39 +08:00
src feat: Add complete persistent history system 2026-01-01 18:07:08 +08:00
tests refactor: Clean up old v1 files and fix LinkInfo type issues 2025-12-31 17:04:10 +08:00
.gitignore feat: Complete FTXUI refactoring with clean architecture 2025-12-29 22:07:39 +08:00
CMakeLists.txt feat: Add complete persistent history system 2026-01-01 18:07:08 +08:00
KEYBOARD.md feat: Add complete persistent history system 2026-01-01 18:07:08 +08:00
LICENSE feat: Complete FTXUI refactoring with clean architecture 2025-12-29 22:07:39 +08:00
README.md feat: Add forward navigation with 'f' key 2026-01-01 00:41:07 +08:00
STATUS.md feat: Add complete persistent history system 2026-01-01 18:07:08 +08:00
test_browse.sh test: Add browser functionality test script 2025-12-31 17:20:43 +08:00

TUT - Terminal UI Textual Browser

A lightweight, high-performance terminal browser with a btop-style interface.

Version License C++

Features

  • btop-style UI - Modern four-panel layout with rounded borders
  • Lightweight - Binary size < 1MB, memory usage < 50MB
  • Fast startup - Launch in < 500ms
  • Vim-style navigation - j/k scrolling, / search, g/G jump
  • Keyboard-driven - Full keyboard navigation with function key shortcuts
  • Themeable - Multiple color themes (default, nord, gruvbox, solarized)
  • Configurable - TOML-based configuration

Screenshot

╭──────────────────────────────────────────────────────────────────────────────╮
│[◀] [▶] [⟳] ╭────────────────────────────────────────────────────────╮ [⚙] [?]│
│           │https://example.com                                      │        │
│           ╰────────────────────────────────────────────────────────╯        │
├──────────────────────────────────────────────────────────────────────────────┤
│                          Example Domain                                      │
├──────────────────────────────────────────────────────────────────────────────┤
│This domain is for use in illustrative examples in documents.                 │
│                                                                              │
│[1] More information...                                                       │
│                                                                              │
├────────────────────────────────────────┬─────────────────────────────────────┤
│📑 Bookmarks                            │📊 Status                            │
│  example.com                           │  ⬇ 1.2 KB  🕐 0.3s                  │
├────────────────────────────────────────┴─────────────────────────────────────┤
│[F1]Help [F2]Bookmarks [F3]History [F10]Quit                                  │
╰──────────────────────────────────────────────────────────────────────────────╯

Installation

Prerequisites

macOS (Homebrew):

brew install cmake gumbo-parser openssl ftxui cpp-httplib toml11

Linux (Debian/Ubuntu):

sudo apt install cmake libgumbo-dev libssl-dev

Building from Source

git clone https://github.com/m1ngsama/TUT.git
cd TUT
cmake -B build -DCMAKE_PREFIX_PATH=/opt/homebrew  # macOS
cmake -B build                                      # Linux
cmake --build build -j$(nproc)

Running

./build/tut                      # Start with blank page
./build/tut https://example.com  # Open URL directly
./build/tut --help               # Show help

Keyboard Shortcuts

Navigation

Key Action
j / Scroll down
k / Scroll up
Space Page down
b Page up
g Go to top
G Go to bottom
Backspace Go back
f Go forward
Key Action
Tab Next link
Shift+Tab Previous link
Enter Follow link
1-9 Jump to link by number
Key Action
/ Start search
n Next result
N Previous result

UI

Key Action
Ctrl+L Focus address bar
F1 / ? Help
F2 Bookmarks
F3 History
Ctrl+D Add bookmark
Ctrl+Q / F10 / q Quit

Configuration

Configuration files are stored in ~/.config/tut/:

~/.config/tut/
├── config.toml      # Main configuration
└── themes/          # Custom themes
    └── mytheme.toml

Example config.toml

[general]
theme = "default"
homepage = "https://example.com"
debug = false

[browser]
timeout = 30
user_agent = "TUT/0.1.0"

[ui]
word_wrap = true
show_images = true

Project Structure

TUT/
├── CMakeLists.txt          # Build configuration
├── README.md               # This file
├── LICENSE                 # MIT License
├── cmake/                  # CMake modules
│   └── version.hpp.in
├── src/                    # Source code
│   ├── main.cpp           # Entry point
│   ├── core/              # Browser engine, HTTP, URL parsing
│   ├── ui/                # FTXUI components
│   ├── renderer/          # HTML rendering
│   └── utils/             # Logger, config, themes
├── tests/                  # Unit and integration tests
│   ├── unit/
│   └── integration/
└── assets/                 # Default configurations
    ├── config.toml
    ├── themes/
    └── keybindings/

Dependencies

Library Purpose Version
FTXUI Terminal UI framework 5.0+
cpp-httplib HTTP client 0.14+
gumbo-parser HTML parsing 0.10+
toml11 TOML configuration 3.8+
OpenSSL HTTPS support 1.1+

Limitations

  • No JavaScript - SPAs and dynamic content won't work
  • No CSS layout - Only basic text formatting
  • No images - ASCII art rendering planned for future
  • Text-only - Focused on readable content

Contributing

Contributions are welcome! Please read the coding style guidelines:

  • C++17 standard
  • Google C++ Style Guide
  • Use .hpp for headers, .cpp for implementation
  • All public APIs must have documentation comments

License

MIT License - see LICENSE file for details.

Authors

Acknowledgments

  • Inspired by btop for UI design
  • FTXUI for the amazing TUI framework
  • lynx and w3m for inspiration