[Midnight Commander] #265: Search finds bold/underlined strings twice



#265: Search finds bold/underlined strings twice
---------------------+------------------------------------------------------
 Reporter:  egmont   |       Owner:       
     Type:  defect   |      Status:  new  
 Priority:  minor    |   Milestone:  4.7  
Component:  mc-core  |     Version:  4.6.2
 Keywords:           |    Blocking:       
Blockedby:           |  
---------------------+------------------------------------------------------
 If you search (F7) in a manual page in mc's built-in viewer, matches whose
 first character is logically bold or underlined (physically yellow or red)
 are found twice. That is, pressing Shift+F7 or 'n' first doesn't do
 anything, only goes to the next match when pressed again.

 The reason seems to be that when you search from the first byte of that
 special string (which is the letter or the underscore before the
 backspace) then it matches first. Later, when you search from the repeated
 letter after the backspace (that is, byte offset increased by two) then it
 matches again.

 An idea for a solution which I'm not sure about: the first match can
 easily be skipped: if haystack's second character is a backspace, then
 just simply pretend it doesn't match. This way only the second match is
 reported. I can't see at the moment whether it would have any effect on
 highlighting (e.g. the first character of the match wouldn't be shown as
 bold/underlined). It would be cleaner to report the first match and skip
 the second, but I can't see how that could easily be done.

 I also cannot see at the moment why backwards search finds everything only
 once, and not twice for bold text.

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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]