Commit graph

15 commits

Author SHA1 Message Date
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
03422136dd feat: Add complete persistent bookmark system
Completed Phase 1 high priority task - comprehensive bookmark management:

BookmarkManager (New):
- JSON persistence to ~/.config/tut/bookmarks.json
- Add, remove, contains, getAll operations
- Automatic sorting by timestamp (newest first)
- Each bookmark stores: title, URL, timestamp
- Handles special characters with JSON escaping
- Auto-creates config directory if needed

UI Integration:
- Bookmark panel in bottom-left of UI
- Shows up to 5 most recent bookmarks
- Displays "[1] Title" format with yellow highlighting
- Shows "+N more..." indicator if >5 bookmarks
- Real-time update when bookmarks change

Keyboard Shortcuts:
- Ctrl+D: Toggle bookmark for current page
  * Adds if not bookmarked
  * Removes if already bookmarked
  * Shows status message confirmation
- F2: Toggle bookmark panel visibility
  * Refreshes bookmark list when opened

Features:
- Persistent storage across browser sessions
- Duplicate detection (one bookmark per URL)
- Toggle behavior (add/remove with same key)
- Real-time panel updates
- Empty state handling ("(empty)" message)
- Sorted display (newest first)

Technical Implementation:
- BookmarkManager class with Pimpl idiom
- Simple JSON format for easy manual editing
- Event-driven architecture (WindowEvent::AddBookmark)
- Lambda callback for bookmark updates
- Integrated with main browser engine

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

Documentation:
- Updated KEYBOARD.md with bookmark shortcuts
- Updated STATUS.md to reflect completion
- Added bookmark feature to interactive features list

Next Step: History system! 📚
2026-01-01 14:08:42 +08:00
6408f0e95c feat: Complete FTXUI refactoring with clean architecture
Major architectural refactoring from ncurses to FTXUI framework with
professional engineering structure.

Project Structure:
- src/core/: Browser engine, URL parser, HTTP client
- src/ui/: FTXUI components (main window, address bar, content view, panels)
- src/renderer/: HTML renderer, text formatter, style parser
- src/utils/: Logger, config manager, theme manager
- tests/unit/: Unit tests for core components
- tests/integration/: Integration tests
- assets/: Default configs, themes, keybindings

New Features:
- btop-style four-panel layout with rounded borders
- TOML-based configuration system
- Multiple color themes (default, nord, gruvbox, solarized)
- Comprehensive logging system
- Modular architecture with clear separation of concerns

Build System:
- Updated CMakeLists.txt for modular build
- Prefer system packages (Homebrew) over FetchContent
- Google Test integration for testing
- Version info generation via cmake/version.hpp.in

Configuration:
- Default config.toml with browser settings
- Four built-in themes
- Default keybindings configuration
- Config stored in ~/.config/tut/

Removed:
- Legacy v1 source files (ncurses-based)
- Old render/ directory
- Duplicate and obsolete test files
- Old documentation files

Binary: ~827KB (well under 5MB goal)
Dependencies: FTXUI, cpp-httplib, toml11, gumbo-parser, OpenSSL
2025-12-29 22:07:39 +08:00
b6150bcab0 feat: Add async image loading with progressive rendering
Phase 10 - Complete async image downloading system

HttpClient enhancements:
- Add ImageDownloadTask structure for async binary downloads
- Implement separate curl multi handle for concurrent image downloads
- Add methods: add_image_download, poll_image_downloads, get_completed_images
- Support configurable concurrency (default: 3 parallel downloads)
- Cancel all images support

Browser improvements:
- Replace synchronous load_images() with async queue_images()
- Progressive rendering - images appear as they download
- Non-blocking UI during image downloads
- Real-time progress display with spinner
- Esc key cancels image loading
- Maintains LRU image cache compatibility

Performance benefits:
- 3x faster image loading (3 concurrent downloads)
- UI remains responsive during downloads
- Users can scroll/navigate while images load
- Gradual page appearance improves perceived performance

Tests:
- test_async_images: Full async download test suite
- test_image_minimal: Minimal async workflow test
- test_simple_image: Basic queueing test

Technical details:
- Dedicated curl multi handle for images (independent of page loading)
- Queue-based download management (pending → loading → completed)
- Progressive relayout as images complete
- Preserves 10-minute LRU image cache
2025-12-28 13:37:54 +08:00
8d56a7b67b feat: Add persistent browsing history
- Implement HistoryManager for JSON persistence (~/.config/tut/history.json)
- Auto-record page visits with URL, title, and timestamp
- Update visit time when revisiting URLs (move to front)
- Limit to 1000 entries maximum
- Add :history command to view browsing history
- History entries are clickable links
- Add test_history test suite
2025-12-27 18:13:40 +08:00
2878b42d36 refactor: Consolidate v2 architecture into main codebase
- Merge browser_v2 implementation into browser.cpp
- Remove deprecated files: browser_v2.cpp/h, main_v2.cpp, text_renderer.cpp/h
- Simplify CMakeLists.txt to build single 'tut' executable
- Remove test HTML files no longer needed
- Add stb_image.h for image support
2025-12-27 17:59:05 +08:00
a469f79a1e test: Add comprehensive test suite for v2.0 release
- test_http_async: Async HTTP fetch, poll, and cancel tests
- test_html_parse: HTML parsing, link resolution, forms, images, Unicode
- test_bookmark: Add/remove/contains/persistence tests
2025-12-27 16:30:05 +08:00
a4c95a6527 feat: Add bookmark management
- Add BookmarkManager class for bookmark CRUD operations
- Store bookmarks in JSON format at ~/.config/tut/bookmarks.json
- Add keyboard shortcuts: B (add), D (remove)
- Add :bookmarks/:bm command to view bookmark list
- Bookmarks page shows clickable links
- Auto-save on add/remove, auto-load on startup
2025-12-27 15:29:44 +08:00
d80d0a1c6e feat: Implement TUT 2.0 with new rendering architecture
Major features:
- New modular architecture with Terminal, FrameBuffer, Renderer layers
- True Color (24-bit) support with warm, eye-friendly color scheme
- Unicode support with proper CJK character width handling
- Differential rendering for improved performance
- Page caching (LRU, 20 pages, 5-minute expiry)
- Search functionality with highlighting (/, n/N)
- Form rendering (input, button, checkbox, radio, select)
- Image placeholder support ([alt text] or [Image: filename])
- Binary data download via fetch_binary()
- Loading state indicators

New files:
- src/browser_v2.cpp/h - Browser with new rendering system
- src/main_v2.cpp - Entry point for tut2
- src/render/* - Terminal, FrameBuffer, Renderer, Layout, Image modules
- src/utils/unicode.cpp/h - Unicode handling utilities
- tests/* - Test programs for each module

Build with: cmake --build build_v2
Run: ./build_v2/tut2 [URL]
2025-12-26 14:56:17 +08:00
0ecedb1aed feat: Add DOM tree implementation and fix compiler warnings
Major improvements:
- Add proper DOM tree structure (dom_tree.cpp/h) with hierarchical node representation
- Refactor HTML parser to use DOM tree instead of flat ContentElement structure
- Enhance text renderer with improved inline content handling and UTF-8 support
- Improve browser interactive element tracking with byte-accurate positioning
- Add comprehensive HTML entity decoding (80+ named entities + numeric)
- Enhance form handling with better field tracking and submission

Code quality improvements:
- Fix all compiler warnings (unused parameters/variables)
- Clean build with zero warnings
- Better separation of concerns between parsing and rendering

Testing:
- Add test_table.html for table rendering verification

This change enables better handling of complex HTML structures while
maintaining the Unix philosophy of simplicity and focus.
2025-12-25 13:18:08 +08:00
430e70d7b6 refactor: Major simplification following Unix philosophy
Removed ~45% dead code and simplified architecture:

Dead Code Removal (~1,687 LOC):
- calendar.cpp/h - Unused calendar stub
- ics_fetcher.cpp/h - Orphaned ICS fetching
- ics_parser.cpp/h - Abandoned iCalendar parsing
- tui_view.cpp/h - Separate UI implementation

Build System:
- Simplified Makefile to CMake wrapper
- Added install target to CMakeLists.txt
- Improved .gitignore for build artifacts
- Removed Chinese comments, replaced with English

Code Simplification:
- Removed unimplemented features:
  * VISUAL/VISUAL_LINE modes (no actual functionality)
  * YANK action (copy not implemented)
  * Tab support (NEXT_TAB, PREV_TAB, etc.)
  * TOGGLE_MOUSE (mouse always enabled)
- Removed process_visual_mode() function (~36 lines)
- Removed gt/gT keybindings for tabs
- Updated help text to remove placeholders

HTML Entity Decoding:
- Made entity list static const (performance)
- Added numeric entity support ({, «)
- Added UTF-8 encoding for decoded entities
- Cleaner, more complete implementation

This brings the browser closer to Unix principles:
- Do one thing well (browse, don't manage calendar)
- Keep it simple (removed over-engineered features)
- Clear, focused codebase (2,058 LOC vs 3,745)

Build tested successfully with only minor warnings.
2025-12-17 15:39:23 +08:00
ab2d1932e4 feat: Transform to vim-style terminal browser (#10)
* feat: Add HTTP/HTTPS client module

Implement HTTP client with libcurl for fetching web pages:
- Support for HTTP and HTTPS protocols
- Configurable timeout and user agent
- Automatic redirect following
- SSL certificate verification
- Pimpl pattern for implementation hiding

This module provides the foundation for web page retrieval
in the terminal browser.

* feat: Add HTML parser and content extraction

Implement HTML parser for extracting readable content:
- Parse HTML structure (headings, paragraphs, lists, links)
- Extract and decode HTML entities
- Smart content area detection (article, main, body)
- Relative URL to absolute URL conversion
- Support for both absolute and relative paths
- Filter out scripts, styles, and non-content elements

The parser uses regex-based extraction optimized for
text-heavy websites and documentation.

* feat: Add newspaper-style text rendering engine

Implement text renderer with adaptive layout:
- Adaptive width with maximum 80 characters
- Center-aligned content for comfortable reading
- Smart text wrapping and paragraph spacing
- Color scheme optimized for terminal reading
- Support for headings, paragraphs, lists, and links
- Link indicators with numbering
- Horizontal rules and visual separators

The renderer creates a newspaper-like reading experience
optimized for terminal displays.

* feat: Implement vim-style input handling

Add complete vim-style keyboard navigation:
- Normal mode: hjkl movement, gg/G jump, numeric prefixes
- Command mode: :q, :o URL, :r, :h, :[number]
- Search mode: / for search, n/N for next/previous match
- Link navigation: Tab/Shift-Tab, Enter to follow
- Scroll commands: Ctrl-D/U, Space, b for page up/down
- History navigation: h for back, l for forward

Input handler manages mode transitions and command parsing
with full vim compatibility.

* feat: Implement browser core with TUI interface

Add main browser engine and user interface:
- Page loading with HTTP client integration
- HTML parsing and text rendering pipeline
- History management (back/forward navigation)
- Link selection and following with Tab navigation
- Search functionality with highlighting
- Scrolling with position tracking
- Status bar with mode indicator and progress
- Built-in help page with usage instructions
- Error handling and user feedback
- Support for static HTML websites

The browser provides a complete vim-style terminal
browsing experience optimized for reading text content.

* build: Update build system for terminal browser

Update CMake and add Makefile for the new project:
- Rename project from NBTCA_TUI to TUT
- Update executable name from nbtca_tui to tut
- Add all new source files to build
- Include Makefile for environments without CMake
- Update .gitignore for build artifacts

Both CMake and Make build systems are now supported
for maximum compatibility.

* docs: Complete project transformation to terminal browser

Transform project from ICS calendar viewer to terminal browser:
- Rewrite main.cpp for browser launch with URL argument support
- Complete README rewrite with:
  - New project description and features
  - Comprehensive keyboard shortcuts documentation
  - Installation guide for multiple platforms
  - Usage examples and best practices
  - JavaScript/SPA limitations explanation
  - Architecture overview
- Add help command line option
- Update version to 1.0.0

The project is now TUT (Terminal User Interface Browser),
a vim-style terminal web browser optimized for reading.
2025-12-05 15:01:21 +08:00
ffacdc8c3e ci: Auto release on push to main with multi-platform builds
- Change trigger from tags to push on main branch
- Add matrix build for macOS and Linux platforms
- Use softprops/action-gh-release for creating releases
- Auto-generate version using date and commit hash
- Upload platform-specific binaries to release
- Fix CMakeLists.txt to conditionally set Homebrew path for macOS only
2025-11-20 11:45:50 +08:00
77784f7453 feat: Modularize calendar and create TUI portal
Refactored the calendar functionality into a separate Calendar class.
Created a TUI portal in main.cpp to allow for future feature expansion.
The TUI portal provides a menu to select different features, with the calendar being the first one.
Updated the build system to include the new files.
2025-11-19 16:34:25 +08:00
e7edc3455f Initial commit: NBTCA TUI with ICS calendar support 2025-11-19 11:50:45 +08:00