This PR introduces inline status caption support for progress indicators (spinners and progress bars) in version 1.1.6, using a single, easy-to-use API:
Update(const Progress: Integer; const ACaption: string = '')The implementation keeps existing Update(Progress) calls working (via the default parameter), while enabling clean inline status text rendering without manual line clearing.
- New feature (non-breaking change which adds functionality)
- Documentation update
- Improvement/refactor (API simplified to single caption usage style)
- Bug fix (non-breaking change which fixes an issue)
- Breaking change (fix or feature that would cause existing functionality to not work as expected)
- Spinners now support inline captions:
Spinner.Update(0, 'Scanning files...');
- Progress bars now support inline captions:
Progress.Update(i, Format('Processed file %d/%d', [i, Count])); - Caption rendering is handled by the indicator itself (no manual blanking needed)
The feature request proposed two options. This release intentionally keeps Option 2 only:
- ✅
Update(Progress, Caption) - ❌
Caption/ShowCaptionproperty API (removed before finalizing)
This keeps the API simpler to maintain and easier to use consistently.
- Progress rendering now tracks previous output length
- Trailing characters are cleared correctly when caption text gets shorter
- Progress bar redraws also occur when caption changes but percentage does not
-
ProgressDemoupdated to use inline captions for spinner + progress bar - Progress indicator API compiles with
Update(Progress)andUpdate(Progress, Caption) - All example applications compile successfully against the updated API
Compiled successfully:
examples/ColorDemo/ColorDemo.lprexamples/ErrorHandlingDemo/ErrorHandlingDemo.lprexamples/LongRunningOpDemo/LongRunningOpDemo.lprexamples/ProgressDemo/ProgressDemo.lprexamples/SimpleDemo/SimpleDemo.lprexamples/SubCommandDemo/SubCommandDemo.lpr
-
src/cli.interfaces.pas- Updated
IProgressIndicator.Updatesignature to:Update(const Progress: Integer; const ACaption: string = '')
- Updated
-
src/cli.progress.pas- Implemented inline caption rendering for spinner/progress bar
- Added render-length tracking for clean overwrites
- Ensured progress bar redraws when caption changes without percentage change
examples/ProgressDemo/ProgressDemo.lpr- Demonstrates inline captions in both spinner and progress bar phases
- Removed separate status line output during progress bar processing
- Bumped demo version string to
1.1.6
CHANGELOG.md- Addedv1.1.6entryREADME.md- Bumped to1.1.6and documented inline caption usagedocs/api-reference.md- Updated progress indicator signaturesdocs/technical-docs.md- Updated architecture/API examplesdocs/user-manual.md- Added/updated progress examples with inline captions
Why only Update(Progress, Caption)?
- Single API path reduces maintenance cost
- Explicit at call sites (no hidden/stale caption state)
- Easier to test and reason about
- Keeps the feature powerful while staying lightweight
None. Existing calls like Update(Progress) remain supported due to the default caption parameter.
- Code follows the project's style guidelines
- Self-review performed
- Documentation updated (README, CHANGELOG, API docs, technical docs, user manual)
- Example updated (
ProgressDemo) - All example projects compile successfully
- No breaking API change for existing
Update(Progress)usage
- Addresses the progress indicator status text/caption feature request (Gus)
- Related branch/topic:
feat/progress-indicators/11-enhance-spinner-and-progress-with-text
Spinner := CreateSpinner(ssLine);
Spinner.Start;
try
Spinner.Update(0, 'Preparing...');
finally
Spinner.Stop;
end;
Progress := CreateProgressBar(10, 20);
Progress.Start;
try
Progress.Update(1, 'Processed file 1/10');
finally
Progress.Stop;
end;This release packages a small but high-impact UX improvement for terminal apps: progress indicators can now display changing status text inline in a clean, framework-managed way.