Ticket #2417: incorrect charset conversion in editor search engine.

Initial step: type accuracy.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2010-11-17 14:06:45 +03:00
parent a14974b996
commit a80c9edb93
4 changed files with 16 additions and 19 deletions

View File

@ -224,7 +224,7 @@ void edit_mark_cmd (WEdit * edit, int unmark);
void edit_set_markers (WEdit * edit, long m1, long m2, int c1, int c2);
void edit_push_markers (WEdit * edit);
void edit_replace_cmd (WEdit * edit, int again);
void edit_search_cmd (WEdit * edit, int again);
void edit_search_cmd (WEdit * edit, gboolean again);
void edit_complete_word_cmd (WEdit * edit);
void edit_get_match_keyword_cmd (WEdit * edit);
int edit_save_block (WEdit * edit, const char *filename, long start, long finish);
@ -335,6 +335,6 @@ extern int option_edit_top_extreme;
extern int option_edit_bottom_extreme;
extern const char *option_whole_chars_search;
extern int search_create_bookmark;
extern gboolean search_create_bookmark;
#endif /* MC_EDIT_IMPL_H */

View File

@ -3539,10 +3539,10 @@ edit_execute_cmd (WEdit * edit, unsigned long command, int char_for_insertion)
break;
case CK_Find:
edit_search_cmd (edit, 0);
edit_search_cmd (edit, FALSE);
break;
case CK_Find_Again:
edit_search_cmd (edit, 1);
edit_search_cmd (edit, TRUE);
break;
case CK_Replace:
edit_replace_cmd (edit, 0);

View File

@ -75,8 +75,7 @@
/* globals: */
/* search and replace: */
int search_create_bookmark = 0;
/* static int search_in_all_charsets = 0; */
int search_create_bookmark = FALSE;
/* queries on a save */
int edit_confirm_save = 1;
@ -92,7 +91,7 @@ edit_search_cmd_search_create_bookmark (WEdit * edit)
long q = 0;
gsize len = 0;
search_create_bookmark = 0;
search_create_bookmark = FALSE;
book_mark_flush (edit, -1);
for (;;)
@ -1904,12 +1903,12 @@ edit_replace_cmd (WEdit * edit, int again)
void
edit_search_cmd (WEdit * edit, int again)
edit_search_cmd (WEdit * edit, gboolean again)
{
char *search_string = NULL, *search_string_dup = NULL;
gsize len = 0;
if (!edit)
if (edit == NULL)
return;
if (edit->search != NULL)
@ -1936,7 +1935,7 @@ edit_search_cmd (WEdit * edit, int again)
#ifdef HAVE_CHARSET
GString *tmp;
if (search_string && *search_string)
if (search_string != NULL && *search_string != '\0')
{
tmp = str_convert_to_display (search_string);
if (tmp != NULL)
@ -1955,7 +1954,7 @@ edit_search_cmd (WEdit * edit, int again)
g_free (search_string_dup);
search_string_dup = NULL;
#ifdef HAVE_CHARSET
if (search_string && *search_string)
if (search_string != NULL && *search_string != '\0')
{
tmp = str_convert_to_input (search_string);
if (tmp != NULL)
@ -1980,14 +1979,14 @@ edit_search_cmd (WEdit * edit, int again)
return;
}
if (edit->search)
if (edit->search != NULL)
{
mc_search_free (edit->search);
edit->search = NULL;
}
}
if (!edit->search)
if (edit->search == NULL)
{
edit->search = mc_search_new (search_string, -1);
if (edit->search == NULL)
@ -2007,16 +2006,14 @@ edit_search_cmd (WEdit * edit, int again)
g_free (search_string);
if (search_create_bookmark)
{
edit_search_cmd_search_create_bookmark (edit);
}
else
{
if (edit->found_len && edit->search_start == edit->found_start + 1
if (edit->found_len != 0 && edit->search_start == edit->found_start + 1
&& edit_search_options.backwards)
edit->search_start--;
if (edit->found_len && edit->search_start == edit->found_start - 1
if (edit->found_len != 0 && edit->search_start == edit->found_start - 1
&& !edit_search_options.backwards)
edit->search_start++;
@ -2035,7 +2032,7 @@ edit_search_cmd (WEdit * edit, int again)
else
{
edit->search_start = edit->curs1;
if (edit->search->error_str)
if (edit->search->error_str != NULL)
edit_error_dialog (_("Search"), edit->search->error_str);
}
}

View File

@ -297,7 +297,7 @@ editcmd_dialog_search_show (WEdit * edit, char **search_text)
if (dialog_result == B_CANCEL)
*search_text = NULL;
else if (dialog_result == B_USER)
search_create_bookmark = 1;
search_create_bookmark = TRUE;
}
}