feat: add timeslider line numbers#7542
Conversation
Review Summary by QodoAdd timeslider line numbers with persistence and alignment
WalkthroughsDescription• Add editor-style line numbers to timeslider gutter with dynamic alignment • Implement line number preference persistence via shared cookie • Update CSS layout to support side-by-side gutter and document display • Add comprehensive frontend tests for line number functionality Diagramflowchart LR
A["User opens timeslider"] --> B["Read line number preference from cookie"]
B --> C["Apply show/hide line numbers setting"]
C --> D["Render document with gutter"]
D --> E["Calculate line heights and offsets"]
E --> F["Display aligned line numbers"]
F --> G["User toggles line numbers in settings"]
G --> H["Save preference to cookie"]
H --> I["Update display and trigger resize"]
File Changes1. src/static/js/broadcast.ts
|
Code Review by Qodo
1. Timeslider line numbers not gated
|
| padutils.bindCheckboxChange($('#options-linenoscheck'), () => { | ||
| const showLineNumbers = padutils.getCheckbox('#options-linenoscheck'); | ||
| setPadPref('showLineNumbers', showLineNumbers); | ||
| applyShowLineNumbers(showLineNumbers); | ||
| }); | ||
| applyShowLineNumbers(readPadPrefs().showLineNumbers !== false); |
There was a problem hiding this comment.
1. Timeslider line numbers not gated 📘 Rule violation ≡ Correctness
The new timeslider line-number feature is enabled by default and is not behind a feature flag. Additionally, line-number DOM updates still run even when the user preference hides them, so the disabled path does not match pre-change behavior.
Agent Prompt
## Issue description
Timeslider line numbers are a new feature but are enabled by default and not gated behind a feature flag. The line-number update logic also runs even when the preference hides line numbers, so the disabled path does not preserve the pre-existing behavior.
## Issue Context
Compliance requires new features to be behind a feature flag and disabled by default, and when disabled the executed code path should match pre-change behavior.
## Fix Focus Areas
- src/static/js/timeslider.ts[202-207]
- src/static/js/broadcast.ts[254-257]
- src/static/js/broadcast.ts[526-534]
- src/templates/timeslider.html[113-118]
- src/static/css/timeslider.css[123-143]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| scheduleLineNumberUpdate(); | ||
| $(window).on('resize', scheduleLineNumberUpdate); | ||
| window.addEventListener('load', scheduleLineNumberUpdate, {once: true}); | ||
| document.fonts?.ready?.then(scheduleLineNumberUpdate); |
There was a problem hiding this comment.
Good idea. Fonts could change the line numbers too.
SamTV12345
left a comment
There was a problem hiding this comment.
could you update the mr title? I think it also adds a configurable cookie for line numbering.
mr title? |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Addresses Qodo review: updateLineNumbers() was called synchronously from applyChangeset() on every changeset, forcing full-document layout reads/writes during timeslider scrubbing/playback. scheduleLineNumberUpdate() also queued a fresh double-rAF pair for every resize tick. Add a pending flag so only one rAF pair is in flight, and route applyChangeset() through the scheduler. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
3aee05b to
41f1aef
Compare
Summary
Closes #4669