tweaks: implement the fix of the previous commit somewhat differently

This commit is contained in:
Benno Schulenberg 2024-02-27 17:21:31 +01:00
parent ee1a1306e2
commit 39db2e9d66

View File

@ -57,10 +57,6 @@ bool regexp_init(const char *regexp)
* full screen refresh when the mark is on, in case the cursor has moved. */ * full screen refresh when the mark is on, in case the cursor has moved. */
void tidy_up_after_search(void) void tidy_up_after_search(void)
{ {
/* Searching in a help text does not support regular expressions. */
if (inhelp)
return;
if (have_compiled_regexp) { if (have_compiled_regexp) {
regfree(&search_regexp); regfree(&search_regexp);
have_compiled_regexp = FALSE; have_compiled_regexp = FALSE;
@ -166,7 +162,9 @@ void search_init(bool replacing, bool retain_answer)
break; break;
} }
tidy_up_after_search(); if (!inhelp)
tidy_up_after_search();
free(thedefault); free(thedefault);
} }
@ -385,7 +383,8 @@ void do_research(void)
go_looking(); go_looking();
tidy_up_after_search(); if (!inhelp)
tidy_up_after_search();
} }
/* Search in the backward direction for the next occurrence. */ /* Search in the backward direction for the next occurrence. */