Bug 159096 - 'Find Next' does not always move to correct line
Summary: 'Find Next' does not always move to correct line
Status: RESOLVED FIXED
Alias: None
Product: konsole
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-03-10 22:09 UTC by Jeff Mitchell
Modified: 2008-03-30 04:54 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jeff Mitchell 2008-03-10 22:09:13 UTC
Version:           2.1 (using Devel)
Installed from:    Compiled sources
Compiler:          G++ 
OS:                Linux

Searching has a few repeatable issues, just tested today with r784131.  You can see it by the following:

1) Output a large amount of text in a window...get a decent amount of text in the scrollback.
2) Go to Scrollback->Search Output
3) If you type a search term in it will color that search term everywhere it appears, however the highlighted bar will be in a place that bears no relation to that actual term.  Pressing "Next" simply moves the highlighted line down one, it doesn't actually move to the next search term (it seems that maybe it moves to the next line in a multi-line block of output that contains that term, but not only to just the lines that contain that term).
4) Open up a new tab.
5) Switch back to the original tab, and it will have gone back to the original, non-matching line that it was at before, instead of staying where it was.
Comment 1 Robert Knight 2008-03-18 17:32:12 UTC
The problem is wrapped lines.  Konsole searches the history in blocks of 10K bytes of text for performance.  When it has identified a match within a search block it attempts to work out the line number by counting occurrences of new line characters in the block.  This produces the wrong result when wrapped lines are present because then there is a mismatch between lines in the search buffer and lines of text on the terminal display.
Comment 2 Robert Knight 2008-03-30 04:54:54 UTC
SVN commit 791703 by knight:

BUG: 159096 ('Find Next' does not always move to correct line)

Squashed commit of the following:

commit 17bd4aee3b20b3d36e0891dfd516d986430133c2
Author: Robert Knight <robertknight@gmail.com>
Date:   Sun Mar 30 03:39:07 2008 +0100

    Use a list of integers rather than a bitmap to record the character positions of new lines.  This allows for empty lines in the buffer which means that multiple lines may start at the same character position.

commit d8ee8002f6ee87257f70f94e1a77a44f668617d9
Author: Robert Knight <robertknight@gmail.com>
Date:   Sun Mar 30 03:22:24 2008 +0100

    Compute the line index of a match found during output search more accurately.  Add a method to record the positions of new lines within the output stream to TerminalCharacterDecoder and use that in SearchHistoryTask to count the number of lines offset from the start of the current block.  Unlike the previous method this works when there are wrapped lines in the output.


 M  +14 -5     SessionController.cpp  
 M  +18 -2     TerminalCharacterDecoder.cpp  
 M  +13 -0     TerminalCharacterDecoder.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=791703