Ticket #265 (closed defect: fixed)

Opened 7 years ago

Last modified 5 years ago

Search finds bold/underlined strings twice

Reported by: egmont Owned by: slavazanko
Priority: minor Milestone: 4.8.0-pre2
Component: mcview Version: 4.8.0-pre1
Keywords: Cc:
Blocked By: Blocking:
Branch state: merged Votes for changeset: commited-master commited-stable

Description

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.

Change History

comment:1 Changed 7 years ago by styx

new beheviour with new search engine

get test file from #265.

  1. open file
  2. make 2 serches of 'ab' forward
  3. then try backward

comment:2 Changed 7 years ago by slavazanko

  • Keywords rework added

see branch 265_finds_bold_underline_in_view
Branch need to complete work - not all funds correctly highlight.

BTW, #264 very coherent to this ticket...

comment:3 Changed 7 years ago by slavazanko

  • Owner set to slavazanko
  • Status changed from new to accepted

comment:4 Changed 7 years ago by slavazanko

  • Keywords review added; rework removed

Well, review please 265_finds_bold_underline_in_view

Bug for this ticket fully closed.

comment:5 Changed 7 years ago by styx

  • Keywords rework added; review removed

it is much better for now, but ...
try to find 'ab' pattern in file from 264

comment:6 Changed 7 years ago by styx

and also try to use backward searching for 'ab' pattern
test file is also in: #264

comment:7 Changed 7 years ago by egmont

Please also see #266 for a long but hopefully useful rant about how hugely conceptually broken the current backwards search is (in 4.6.2 - not sure about dev).

comment:8 Changed 7 years ago by slavazanko

  • Blocking 375 added

comment:9 Changed 7 years ago by slavazanko

  • Keywords review added; rework removed

Okay, I think branch 265_finds_bold_underline_in_view now reading for review.

Error from #264 fixed, twice-search behavior from this ticket fixed and no raise search result on any 'red text' by '_' search keyword.

Review please.

comment:10 Changed 7 years ago by andrew_b

  • Keywords vote-andrew_b added

Works correct. My vote here.

comment:11 Changed 7 years ago by styx

  • Keywords vote-styx approved added; review removed

comment:12 Changed 7 years ago by slavazanko

  • Status changed from accepted to testing
  • Keywords commited-master added; vote-andrew_b vote-styx approved removed
  • Resolution set to fixed

comment:13 Changed 7 years ago by slavazanko

  • Status changed from testing to closed

comment:14 Changed 7 years ago by slavazanko

  • Blocking 375 removed

(In #375) Fixed in #265

comment:15 Changed 5 years ago by slavazanko

  • Blocked By 2294 added

(In #2294) Created branch 2294_viewer_search_offset

Initial changeset:899bcae078f2dfc82182b05268c4c691a467220b

Review, please.

I think it's better to have duplicate matches in a rare use case rather than missing some matches in a more common use case.

You right, after resolve this issue #265 will be reopened.

comment:16 Changed 5 years ago by slavazanko

  • Blocked By 2294 removed

(In #2294) Merge changeset:becd744bb664ea0b7c6ffeef99113ea851cdc695

For getting list of commits type:

git log --pretty=oneline 906f688..3ad5f51

comment:17 Changed 5 years ago by slavazanko

  • Status changed from closed to reopened
  • Resolution fixed deleted
  • severity set to no branch

comment:18 Changed 5 years ago by slavazanko

  • Keywords commited-master removed

comment:19 Changed 5 years ago by slavazanko

  • Blocked By 1629 added

comment:20 Changed 5 years ago by slavazanko

  • Blocked By 1629 removed

(In #1629) Merge changeset:d7fd84507c063adb79b02b544d07203b73518831

Commits:

git log --pretty=oneline 7d52669..79660a7

comment:21 Changed 5 years ago by slavazanko

  • Status changed from reopened to accepted
  • Component changed from mc-core to mcview
  • Version changed from 4.6.2 to 4.8.0-pre1
  • Branch state set to on review
  • Milestone changed from 4.7 to 4.8.0-pre2
  • Keywords stable-candidate added

Created branch 265_viewer_search_nroffed_twice

initial changeset:a20c7a648b1569a388794913a71039de99f33c60

review, please

Last edited 5 years ago by andrew_b (previous) (diff)

comment:22 Changed 5 years ago by angel_il

  • Votes for changeset set to angel_il

comment:23 Changed 5 years ago by andrew_b

  • Votes for changeset changed from angel_il to andrew_b

comment:24 Changed 5 years ago by angel_il

  • Votes for changeset changed from andrew_b to andrew_b angel_il
  • Branch state changed from on review to approved

comment:25 Changed 5 years ago by slavazanko

  • Status changed from accepted to testing
  • Votes for changeset changed from andrew_b angel_il to commited-master
  • Resolution set to fixed
  • Branch state changed from approved to merged

merge changeset:1dc4c30eb9811b0a1e4339fb7ea4af516e15680f

commints in branch:

git log --pretty=oneline c119682..b3e9a75

comment:26 Changed 5 years ago by slavazanko

  • Keywords stable-candidate removed
  • Status changed from testing to closed
  • Votes for changeset changed from commited-master to commited-master commited-stable

Cherry-picked in stable:

git log --pretty=oneline a1cc8f37e5..ec441ece0f
Note: See TracTickets for help on using tickets.