Commit graph

10 commits

Author SHA1 Message Date
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
159e299e96 feat: Add forward navigation with 'f' key
Completed Phase 1 high priority task:

Interactive Features:
- Add 'f' keyboard shortcut for forward navigation
- Forward button in UI now fully functional
- Works in tandem with Backspace (back) navigation
- Only enabled when browser can go forward

Documentation:
- Updated KEYBOARD.md with 'f' key
- Updated README.md keyboard shortcuts
- Updated STATUS.md to reflect completion
- Updated help text in main.cpp

Keyboard shortcuts:
- Backspace: Go back
- f: Go forward
- Both check navigation state before allowing action

The browser now has complete bidirectional navigation! 
2026-01-01 00:41:07 +08:00
c965472ac5 feat: Add fully interactive browsing with scrolling and link navigation
Implemented complete interactive browser experience with keyboard-driven
navigation.

Interactive Features Added:
 Content Scrolling
  - j/k or arrow keys: Line-by-line scrolling
  - Space/b or PageUp/PageDown: Page scrolling
  - g/G: Jump to top/bottom
  - Real-time scroll position indicator

 Link Navigation
  - Tab/Shift+Tab: Cycle through links
  - 1-9 number keys: Jump directly to links
  - Enter: Follow selected link
  - Selected link highlighted in status bar

 Browser Navigation
  - Back/forward button state (dimmed when unavailable)
  - Backspace: Go back in history
  - r/F5: Refresh page
  - o: Open address bar to enter new URL

 Enhanced UI
  - Status panel shows load stats (KB, time, link count)
  - Selected link URL shown in status bar
  - Scroll position indicator
  - Navigation button states

Technical Implementation:
- Rewrote MainWindow with full FTXUI event handling
- Implemented content line splitting for scrolling
- Added link selection state management
- Wired up browser engine callbacks
- Added timing and statistics tracking
- Proper back/forward history support

Files Modified:
- src/ui/main_window.cpp - Complete rewrite with interactive features
- src/main.cpp - Wire up all callbacks and link handling
- KEYBOARD.md - Complete keyboard shortcuts reference

Tested with:
https://tldp.org/HOWTO/HOWTO-INDEX/howtos.html
https://example.com

The browser is now fully interactive and usable for real web browsing! 🎉
2025-12-31 17:50:15 +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
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
ef80f9ab82 refactor: Improve code quality and Unix philosophy
- Remove redundant comments for cleaner code
- Simplify error messages and status display
- Improve code consistency across modules
- Fix GitHub Actions workflow binary names
- Enhance .gitignore for common editor files
- Align help text formatting
- Remove unnecessary verbose comments
2025-12-08 15:53:17 +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
9f334ec0a0 feat: Add ASCII art and ANSI shadow effects to TUI 2025-11-19 17:27:46 +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