mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +03:00
Fix search in internal viewer in case of nroff mode.
(mc_search__run_regex): fix conditions. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
29f6dd2a84
commit
377807c5de
@ -808,12 +808,9 @@ mc_search__run_regex (mc_search_t * lc_mc_search, const void *user_data,
|
|||||||
|
|
||||||
if (lc_mc_search->search_fn != NULL)
|
if (lc_mc_search->search_fn != NULL)
|
||||||
{
|
{
|
||||||
int current_chr;
|
while (TRUE)
|
||||||
|
|
||||||
do
|
|
||||||
{
|
{
|
||||||
/* stop search symbol */
|
int current_chr = '\n'; /* stop search symbol */
|
||||||
current_chr = '\n';
|
|
||||||
|
|
||||||
ret = lc_mc_search->search_fn (user_data, current_pos, ¤t_chr);
|
ret = lc_mc_search->search_fn (user_data, current_pos, ¤t_chr);
|
||||||
|
|
||||||
@ -831,26 +828,30 @@ mc_search__run_regex (mc_search_t * lc_mc_search, const void *user_data,
|
|||||||
virtual_pos++;
|
virtual_pos++;
|
||||||
|
|
||||||
g_string_append_c (lc_mc_search->regex_buffer, (char) current_chr);
|
g_string_append_c (lc_mc_search->regex_buffer, (char) current_chr);
|
||||||
|
|
||||||
|
if ((char) current_chr == '\n' || virtual_pos > end_search)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
while ((char) current_chr != '\n' && virtual_pos <= end_search);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char current_chr;
|
|
||||||
|
|
||||||
/* optimization for standard case (for search from file manager)
|
/* optimization for standard case (for search from file manager)
|
||||||
* where there is no MC_SEARCH_CB_INVALID or MC_SEARCH_CB_SKIP
|
* where there is no MC_SEARCH_CB_INVALID or MC_SEARCH_CB_SKIP
|
||||||
* return codes, so we can copy line at regex buffer all at once
|
* return codes, so we can copy line at regex buffer all at once
|
||||||
*/
|
*/
|
||||||
do
|
while (TRUE)
|
||||||
{
|
{
|
||||||
|
char current_chr;
|
||||||
|
|
||||||
current_chr = ((char *) user_data)[current_pos];
|
current_chr = ((char *) user_data)[current_pos];
|
||||||
if (current_chr == '\0')
|
if (current_chr == '\0')
|
||||||
break;
|
break;
|
||||||
|
|
||||||
current_pos++;
|
current_pos++;
|
||||||
|
|
||||||
|
if (current_chr == '\n' || current_pos > end_search)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
while (current_chr != '\n' && current_pos <= end_search);
|
|
||||||
|
|
||||||
/* use virtual_pos as index of start of current chunk */
|
/* use virtual_pos as index of start of current chunk */
|
||||||
g_string_append_len (lc_mc_search->regex_buffer, (char *) user_data + virtual_pos,
|
g_string_append_len (lc_mc_search->regex_buffer, (char *) user_data + virtual_pos,
|
||||||
|
Loading…
Reference in New Issue
Block a user