feat: add LiveSpeedGraph setting to toggle between EMA smoothing and raw speed data#340
Merged
SuperCoolPencil merged 4 commits intomainfrom Apr 10, 2026
Merged
feat: add LiveSpeedGraph setting to toggle between EMA smoothing and raw speed data#340SuperCoolPencil merged 4 commits intomainfrom
SuperCoolPencil merged 4 commits intomainfrom
Conversation
… UI components to use consistent width calculations
Comment on lines
+145
to
+147
| // Truncate title and description if needed | ||
| // m.Width() is the available space for the list item | ||
| availableWidth := m.Width() - 4 // Account for prefix and some padding |
Contributor
There was a problem hiding this comment.
"What" comment rather than "why"
// m.Width() is the available space for the list item simply restates what the API call returns and doesn't explain the intent behind the -4 offset (e.g. how it accounts for the 2-cell prefix plus a 2-cell safety margin). Per the project's comment guidelines, comments should explain why the code exists.
Suggested change
| // Truncate title and description if needed | |
| // m.Width() is the available space for the list item | |
| availableWidth := m.Width() - 4 // Account for prefix and some padding | |
| // Truncate title and description if needed. | |
| // Subtract 4 to leave room for the 2-cell prefix and a 2-cell right margin. | |
| availableWidth := m.Width() - 4 |
Rule Used: What: Comments must explain why code exists, not... (source)
Prompt To Fix With AI
This is a comment left during a code review.
Path: internal/tui/list.go
Line: 145-147
Comment:
**"What" comment rather than "why"**
`// m.Width() is the available space for the list item` simply restates what the API call returns and doesn't explain the intent behind the `-4` offset (e.g. how it accounts for the 2-cell prefix plus a 2-cell safety margin). Per the project's comment guidelines, comments should explain *why* the code exists.
```suggestion
// Truncate title and description if needed.
// Subtract 4 to leave room for the 2-cell prefix and a 2-cell right margin.
availableWidth := m.Width() - 4
```
**Rule Used:** What: Comments must explain *why* code exists, not... ([source](https://app.greptile.com/review/custom-context?memory=4e45ef13-32c2-4753-8060-a44ef767144d))
How can I resolve this? If you propose a fix, please make it concise.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Greptile Summary
This PR adds a
LiveSpeedGraphboolean setting that lets users toggle between raw speed and EMA-smoothed speed in the speed graph. It also ships a collection of related UI quality improvements:truncateStringis rewritten to uselipgloss.Width/MaxWidthfor correct Unicode terminal-width handling, the label-offset in the focused details panel is corrected from-8to-12(matchingStatsLabelStyle.Width(12)), description lines in the download list are now truncated, andd.IDreceives truncation it was previously missing.Confidence Score: 5/5
Safe to merge — the feature logic is correct and the accompanying UI fixes are improvements over the previous behavior.
All findings are P2 style suggestions. The core LiveSpeedGraph toggle is implemented correctly, the EMA fallback path is preserved, and the truncation refactor fixes real Unicode-width and overflow bugs.
No files require special attention.
Important Files Changed
live_speed_graphboolean entry to the settings table with accurate description and correct default (false).LiveSpeedGraph boolfield toGeneralSettingswith JSON tag, UI labels, and afalsedefault — straightforward and clean.else smoothed = totalSpeed) is preserved for EMA mode.truncateStringto uselipgloss.Width/MaxWidthfor proper Unicode terminal-width handling; corrects the label-offset from -8 to -12 (matchingStatsLabelStyle.Width(12)) and addsd.IDtruncation.truncateString.MaxWidthand hoists the style out of the loop; minor "what" comment on the hoisted style variable.Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD A[processProgressMsg] --> B{GraphUpdateInterval elapsed?} B -- No --> Z[Skip graph update] B -- Yes --> C[calcTotalSpeed] C --> D{Settings != nil &&\nLiveSpeedGraph?} D -- Yes --> E[smoothed = totalSpeed\n raw speed] D -- No --> F{len SpeedHistory > 0?} F -- Yes --> G[EMA: α·speed + 1-α·prev\nα = 0.3] F -- No --> H[smoothed = totalSpeed\n first-point fallback] E --> I[Append to SpeedHistory] G --> I H --> IComments Outside Diff (1)
internal/tui/process.go, line 54-58 (link)The outer comment on line 54 still reads "Update speed graph history with EMA smoothing for smooth transitions", but EMA is now only applied when
LiveSpeedGraphisfalse. The comment describes a conditional behaviour as if it were unconditional, and it explains what happens rather than why the two modes exist.Rule Used: What: Comments must explain why code exists, not... (source)
Prompt To Fix With AI
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Prompt To Fix All With AI
Reviews (2): Last reviewed commit: "refactor: optimize box content truncatio..." | Re-trigger Greptile