Skip to content

show surrounding text context on manual pause and fix programmatic pause loop#14

Open
fran-jag wants to merge 3 commits intothomaskolmans:mainfrom
fran-jag:show-text-while-paused
Open

show surrounding text context on manual pause and fix programmatic pause loop#14
fran-jag wants to merge 3 commits intothomaskolmans:mainfrom
fran-jag:show-text-while-paused

Conversation

@fran-jag
Copy link
Copy Markdown

@fran-jag fran-jag commented Mar 4, 2026

Description
This PR enhances the reading experience by providing surrounding text context whenever the user
manually pauses the reader. It also includes a fix for the "Pause every N words" feature
and adds a new setting to toggle the context view.

Key Changes

  1. Context View on Pause (Feature)
  • When the reader is manually paused (via Space or the Pause button), the display now shows up to
    60 words of context (previous and next) around the current word.
  • The context is styled in a light gray tone with a smaller font to maintain focus on the current
    word while providing broader situational awareness.
  • Updated the layout to support multi-line wrapping for the context words, ensuring a clean and
    readable "paragraph" feel during breaks.
  1. Settings Integration
  • Added a new toggle in the Display section of the Settings panel: "Show context when paused".
  • This allows users to opt-out of the context view if they prefer the traditional minimal RSVP
    interface.
  • The setting is persisted in the browser's local storage along with other session data.
  1. Bug Fix: Programmatic Pause Loop
  • Fixed a bug where the "Pause every N words" feature would enter an infinite loop or cause the UI
    to "flash/stuck" because the pause trigger was checked before the word index was incremented.
  • Refined the logic to ensure that programmatic pauses do not trigger the context view, preserving
    the reading rhythm for automated breaks.
  1. UI Refinements
  • Multi-word Mode Compatibility: Ensured that "Words shown simultaneously" are hidden when the
    paused context is active to prevent word duplication on screen.
  • RTL Support: Maintained compatibility with Right-to-Left (RTL) scripts for the new context
    layout.

Technical Details

  • src/App.svelte: Introduced isManualPause state to distinguish between user-triggered pauses
    and automated ones. Updated derived states for contextBefore and contextAfter.
  • src/lib/components/RSVPDisplay.svelte: Updated CSS and template logic to handle flexible
    container heights and multi-line text wrapping when showContext is active.
  • src/lib/components/Settings.svelte: Expanded the UI to include the new toggle.

Testing Performed

  • Verified manual pause triggers context correctly.
  • Verified "Pause every N words" resumes playback as expected without showing context.
  • Tested toggle functionality in Settings.
  • Confirmed that multi-word mode does not clash/duplicate text when pausing.
  • Verified session saving/loading preserves the new setting.

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.

1 participant