Ticket #4395 (closed defect: duplicate)

Opened 2 years ago

Last modified 2 years ago

Search ignores newlines

Reported by: sxmboer2 Owned by:
Priority: major Milestone:
Component: mc-search Version: master
Keywords: search newline Cc:
Blocked By: Blocking:
Branch state: no branch Votes for changeset:

Description

I have used mc for about 25 years and this is a *longstanding* bug introduced probably in Jan 2010 when the search engine was split over a regex/normal/hex/... implementation. I think this bug report is related to ticket #400; if not exactly the same.

Older versions of mc allowed one to search (and replace) for multi-line strings, e.g.:
"some text

some more text"

to do so, in the editor: hit search text CTRL-Q ENTER CTRL-Q ENTER some ENTER
used to find the string spanning the three lines, but that stopped working at that time.

Another example: to find/replace an indented line in a file:
F7 CTRL-Q TAB CTRL-Q ENTER (enter) will not find any occurrence.
Other examples also do not make it possible to find filenames in the panel with a newline in the filename either in file selection dialogue or the find file/panelize function and so on.

The included patch fixes all these issues and reverts mc back to the <= mc-4.6.x behavior.

Also, the current patch will also make it possible to do a search and replace in regex mode, for instance to replace every triple newline followed by a tab by a single newline by entering the following two inputs in the search dialogue:
"\n\n\n\t" "\n"

I have tested all functions calling the mc_search function and have found no adverse effects after this patch.

Attachments

searchfix.diff (841 bytes) - added by sxmboer2 2 years ago.
patch to fix newlines being ignored in search engine
searchnewline.diff (1.2 KB) - added by sxmboer2 2 years ago.

Change History

Changed 2 years ago by sxmboer2

patch to fix newlines being ignored in search engine

comment:1 Changed 2 years ago by andrew_b

  • Status changed from new to closed
  • Resolution set to duplicate
  • Milestone 4.8.29 deleted

Closed as duplicate of #400.

comment:2 Changed 2 years ago by sxmboer2

Not sure why the ticket was closed, if ticket #400 did not resolve the problem and the bug is a current issue.
I found some boundary conditions in editor searches that show the bug fix was incomplete. I will try to attach a second diff file to fix the boundary condition.

Changed 2 years ago by sxmboer2

Note: See TracTickets for help on using tickets.