Skip to content

new features: add word count status bar and recent files menu#165

Merged
petertzy merged 2 commits into
petertzy:mainfrom
dhuhaaf:new-tasks
Apr 23, 2026
Merged

new features: add word count status bar and recent files menu#165
petertzy merged 2 commits into
petertzy:mainfrom
dhuhaaf:new-tasks

Conversation

@dhuhaaf

@dhuhaaf dhuhaaf commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

Feature 1: Word Count and Reading Time Status Bar
A persistent status bar at the bottom of each editor tab showing live word count, character count (with and without spaces), and estimated reading time, updating in real time as the user types.

  • Markdown-aware counting: strips headings, bold/italic markers, fenced code blocks, inline code, links, images, HTML tags, and table pipes before counting so the displayed count reflects readable prose words
  • CJK character support: each Chinese, Japanese, and Korean character is counted as one word
  • Debounced updates (400ms idle timer) to prevent UI lag on large documents
  • Selection statistics: when text is selected, the bar additionally shows the word and character count of the selected region only
  • Estimated reading time calculated at 238 wpm (standard average)
  • Per-tab independent: each tab maintains its own count and switching tabs updates the bar immediately

Feature 2: Persistent Recent Files Menu
A File -> Recent Files submenu tracking the last 10 opened file paths, persisting across sessions, with single-click reopening.

  • Persists using the existing settings JSON file (APP_SETTINGS_FILE_PATH) with no new persistence mechanism introduced
  • Merges only the recent_files key on write so all other settings keys (AI provider, model selections, etc.) are fully preserved
  • Atomic file writes (write to temp file, then os.replace) to prevent settings corruption on unexpected shutdown
  • Cross-platform path normalisation via os.path.normpath
  • Paths that no longer exist are pruned on load and shown as disabled [not found] entries if they disappear between load and click
  • Long paths truncated with a middle ellipsis
  • Empty list shows a disabled "(no recent files)" placeholder
  • "Clear Recent Files" option at the bottom of the submenu

Files Changed:

  • word_count_bar.py (new): WordCountBar widget and all counting logic
  • recent_files.py (new): RecentFilesManager class and helper functions
  • markdown_reader/ui.py: wires both features into the existing tab
    lifecycle and menu construction
  • test_features.py (new): 43 unit tests covering both features

@dhuhaaf dhuhaaf requested review from Xavi1 and petertzy as code owners April 22, 2026 23:41
@petertzy petertzy merged commit 9221bb0 into petertzy:main Apr 23, 2026
2 checks passed
github-actions Bot added a commit that referenced this pull request Apr 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants