[Midnight Commander] #264: Search bug with manpages bold/underlined text

Ticket System tickets at midnight-commander.org
Fri Feb 6 20:14:31 UTC 2009


#264: Search bug with manpages bold/underlined text
---------------------+------------------------------------------------------
 Reporter:  egmont   |       Owner:       
     Type:  defect   |      Status:  new  
 Priority:  minor    |   Milestone:  4.7  
Component:  mc-core  |     Version:  4.6.2
 Keywords:           |    Blocking:       
Blockedby:           |  
---------------------+------------------------------------------------------
 Occasionally when you do a simple search (F7) in mc's built-in viewer
 while viewing a manual page, it doesn't find some yellow or red ("bold" or
 "underlined") text.

 Patch attached to fix the problem.

 Example test case: See the attached file that contains "abababc" in bold
 (that is, each letter followed by a backspace, then the same letter
 again). Search for "ababc" and it won't match that string, though it
 should.

 Explanation (line numbers according to 4.6.2):
 In src/util.c: _icase_search() line 812-815 you increase "e" (the haystack
 pointer) and "dlng" (counitng characters that were skipped because of a
 backspace) every time you skip a character and the subsequent backspace in
 the haystack. Later, in line 819, if the partial match turns out not to be
 a complete one, you rewind the haystack pointer by the number of chars
 matched from the needle ("d - text"). This, however, forgets about the
 forward steps that were taken in haystack because of the backspaces. So
 next time the substring match starts from the wrong position.

-- 
Ticket URL: <www.midnight-commander.org/ticket/264>
Midnight Commander <www.midnight-commander.org>
Midnight Development Center


More information about the mc-devel mailing list