feat: implement smart scroll for terminal output#506
Conversation
|
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
|
Hi @dzw1995. Thanks for your PR. I'm waiting for a linuxdeepin member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
Note
详情{
"src/views/termwidget.cpp": [
{
"line": " QString strUrl = \"https://cn.bing.com/search?q=\" + selectedText();",
"line_number": 701,
"rule": "S35",
"reason": "Url link | fd576f862d"
},
{
"line": " QString strUrl = \"https://www.baidu.com/s?wd=\" + selectedText();",
"line_number": 708,
"rule": "S35",
"reason": "Url link | 6f8d292d20"
},
{
"line": " QString strUrl = \"https://github.com/search?q=\" + selectedText();",
"line_number": 715,
"rule": "S35",
"reason": "Url link | e1ba2d7c70"
},
{
"line": " QString strUrl = \"https://stackoverflow.com/search?q=\" + selectedText();",
"line_number": 722,
"rule": "S35",
"reason": "Url link | bd659725f2"
}
]
} |
|
Note
详情{
"src/views/termwidget.cpp": [
{
"line": " QString strUrl = \"https://cn.bing.com/search?q=\" + selectedText();",
"line_number": 701,
"rule": "S35",
"reason": "Url link | fd576f862d"
},
{
"line": " QString strUrl = \"https://www.baidu.com/s?wd=\" + selectedText();",
"line_number": 708,
"rule": "S35",
"reason": "Url link | 6f8d292d20"
},
{
"line": " QString strUrl = \"https://github.com/search?q=\" + selectedText();",
"line_number": 715,
"rule": "S35",
"reason": "Url link | e1ba2d7c70"
},
{
"line": " QString strUrl = \"https://stackoverflow.com/search?q=\" + selectedText();",
"line_number": 722,
"rule": "S35",
"reason": "Url link | bd659725f2"
}
]
} |
|
Thanks for the contribution! The smart scroll feature is a reasonable improvement. However, there's a logic issue in the current implementation that prevents it from working correctly. Please revise and resubmit. Core IssueIn // Current code (broken)
if (getIsAllowScroll()) {
setTrackOutput(Settings::instance()->OutputtingScroll()); // 1. Unconditionally sets true
if (isAtEndOfOutput()) {
setTrackOutput(true); // 2. Redundant
} else {
// 3. Missing setTrackOutput(false) — the true from step 1 already took effect
}
}Problems:
Suggested Fixif (getIsAllowScroll()) {
setTrackOutput(isAtEndOfOutput());
setIsAllowScroll(true);
}This one-liner Minor Suggestions
|
8d56700 to
bce585c
Compare
Implement smart scrolling behavior that only auto-scrolls when user is already at the bottom of the terminal. This allows users to scroll up and view history without being forced back to the bottom when new output arrives. Changes: - Add isAtEndOfOutput() method to QTermWidget - Modify onQTermWidgetReceivedData() to check user position before scrolling - Improves experience with high-frequency output apps like kimi-cli - Enhanced debug logging for scroll behavior Fixes: Users can now scroll up to view history while output is ongoing
…t()) Implement smart scrolling behavior that only auto-scrolls when user is already at the bottom of the terminal. This allows users to scroll up and view history without being forced back to the bottom when new output arrives. Changes: - Replace broken logic that didn't call setTrackOutput(false) when scrolled up - Use setTrackOutput(isAtEndOfOutput()) to properly auto-scroll when at bottom - Removed 6 excessive qCDebug logs - Updated comment style in qtermwidget.h to match project format (dzw1995 2026-04-03) Fixes: Users can now scroll up to view history while output is ongoing
Review of fix commit (bce585c)Thanks for addressing the previous feedback. The one-liner Remaining issue:
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: dzw1995, lzwind The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Implement smart scrolling behavior that only auto-scrolls when user is already at the bottom of the terminal. This allows users to scroll up and view history without being forced back to the bottom when new output arrives.
Changes:
Fixes: Users can now scroll up to view history while output is ongoing