1
1

Fixed search for first symbol in string.

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
Этот коммит содержится в:
Slava Zanko 2011-07-14 11:14:17 +03:00
родитель 15cb151fce
Коммит ba2f67e0ac

Просмотреть файл

@ -53,7 +53,7 @@
/*** file scope variables ************************************************************************/ /*** file scope variables ************************************************************************/
static int search_cb_char_curr_index = 0; static int search_cb_char_curr_index = -1;
static char search_cb_char_buffer[6]; static char search_cb_char_buffer[6];
/*** file scope functions ************************************************************************/ /*** file scope functions ************************************************************************/
@ -81,6 +81,7 @@ mcview_find (mcview_t * view, gsize search_start, gsize * len)
gsize search_end; gsize search_end;
view->search_numNeedSkipChar = 0; view->search_numNeedSkipChar = 0;
search_cb_char_curr_index = -1;
if (mcview_search_options.backwards) if (mcview_search_options.backwards)
{ {
@ -171,6 +172,15 @@ mcview_search_cmd_callback (const void *user_data, gsize char_offset)
return MC_SEARCH_CB_SKIP; return MC_SEARCH_CB_SKIP;
} }
if (search_cb_char_curr_index == -1)
{
search_cb_char_curr_index = 0;
if (view->search_nroff_seq->char_width > 1)
g_unichar_to_utf8 (view->search_nroff_seq->current_char, search_cb_char_buffer);
else
search_cb_char_buffer[0] = (char) view->search_nroff_seq->current_char;
}
if (search_cb_char_curr_index < view->search_nroff_seq->char_width) if (search_cb_char_curr_index < view->search_nroff_seq->char_width)
{ {
lc_byte = search_cb_char_buffer[search_cb_char_curr_index]; lc_byte = search_cb_char_buffer[search_cb_char_curr_index];