Bug 510762 - Backwards search starts from the beginning of scrollback rather than end
Summary: Backwards search starts from the beginning of scrollback rather than end
Status: REPORTED
Alias: None
Product: konsole
Classification: Applications
Component: history (other bugs)
Version First Reported In: master
Platform: KDE Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-10-18 18:06 UTC by bugreporter
Modified: 2025-10-19 12:12 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Tentative patch that seems to fix backwards search (478 bytes, patch)
2025-10-18 18:06 UTC, bugreporter
Details
Observed behavior: unexpectingly jumps to top of scrollback history (851.18 KB, video/webm)
2025-10-19 12:10 UTC, bugreporter
Details
Expected behavior (locally patched): backwards search correctly matches right before cursor (379.68 KB, video/webm)
2025-10-19 12:12 UTC, bugreporter
Details

Note You need to log in before you can comment on or make changes to this bug.
Description bugreporter 2025-10-18 18:06:21 UTC
Created attachment 185885 [details]
Tentative patch that seems to fix backwards search

SUMMARY
Even when the "search backwards" option is enabled (default), searching for a word first jumps to the beginning of scrollback history and then searches backwards from there.

I think this is a bug since it defeats the purpose of backward search. I would expect a backward search to begin from the current prompt (bottom of scrollback history) rather than the top.

STEPS TO REPRODUCE
1. On KDE Linux, or probably other KDE distributions (confirmed on Debian stable), run the following commands in a new Konsole session:

% echo foo
foo
% sudo dmesg | tail -n200
(this is just for filling scrollback history and make the first lines scroll away)
% echo foo
foo

2. Click "Find" or press Ctrl+Shift+F

3. Search for "foo"

OBSERVED RESULT
The first match is near the beginning of scrollback history.

EXPECTED RESULT
The first match should be the last "foo" at the bottom, just before the current prompt, since we are supposed to search backwards.

SOFTWARE/OS VERSIONS
Operating System: KDE Linux 2025-10-18
KDE Plasma Version: 6.5.80
KDE Frameworks Version: 6.20.0
Qt Version: 6.10.0

ADDITIONAL INFORMATION
I can make it work the way I expect by removing the scrollTo(_searchStartLine) call in SessionController::searchTextChanged().

However this call is probably there for a reason, and I haven't studied the Konsole code very well, so it might not be the best way to solve this bug.

So I'm just attaching a sample patch here not as a merge request, but to help actual Konsole devs know where to start looking.
Comment 1 bugreporter 2025-10-19 12:10:01 UTC
Created attachment 185898 [details]
Observed behavior: unexpectingly jumps to top of scrollback history
Comment 2 bugreporter 2025-10-19 12:12:11 UTC
Created attachment 185899 [details]
Expected behavior (locally patched): backwards search correctly matches right before cursor