fix search problem on different charset page than display charset

* proto.h (conv_search_string): added
* search.c (migemostr): use conv_search_string
	(conv_search_string): added
* main.c (srchcore): use conv_search_string
	(reMark): ditto
* menu.c (menu_search_forward): ditto
	(menu_search_backward): ditto
	(menu_search_next_previous): ditto
From: Fumitoshi UKAI  <ukai@debian.or.jp>
This commit is contained in:
Fumitoshi UKAI
2004-03-23 16:44:02 +00:00
parent 8089d0558e
commit f8ca559c64
5 changed files with 41 additions and 35 deletions
+14 -2
View File
@@ -1,4 +1,16 @@
2004-03-23 Fumitoshi UKAI <ukai@ukai.org> 2004-03-24 Fumitoshi UKAI <ukai@debian.or.jp>
* fix search problem on different charset page than display charset
* proto.h (conv_search_string): added
* search.c (migemostr): use conv_search_string
(conv_search_string): added
* main.c (srchcore): use conv_search_string
(reMark): ditto
* menu.c (menu_search_forward): ditto
(menu_search_backward): ditto
(menu_search_next_previous): ditto
2004-03-23 Fumitoshi UKAI <ukai@debian.or.jp>
* rc.c: cleanup LANG == JA * rc.c: cleanup LANG == JA
@@ -8355,4 +8367,4 @@ a * [w3m-dev 03276] compile error on EWS4800
* release-0-2-1 * release-0-2-1
* import w3m-0.2.1 * import w3m-0.2.1
$Id: ChangeLog,v 1.913 2004/03/23 16:31:43 ukai Exp $ $Id: ChangeLog,v 1.914 2004/03/23 16:44:02 ukai Exp $
+3 -13
View File
@@ -1,4 +1,4 @@
/* $Id: main.c,v 1.240 2004/03/22 17:12:33 ukai Exp $ */ /* $Id: main.c,v 1.241 2004/03/23 16:44:02 ukai Exp $ */
#define MAINPROGRAM #define MAINPROGRAM
#include "fm.h" #include "fm.h"
#include <signal.h> #include <signal.h>
@@ -1604,13 +1604,7 @@ srchcore(char *volatile str, int (*func) (Buffer *, char *))
if (SearchString == NULL || *SearchString == '\0') if (SearchString == NULL || *SearchString == '\0')
return SR_NOTFOUND; return SR_NOTFOUND;
#ifdef USE_M17N str = conv_search_string(SearchString, DisplayCharset);
if (SearchConv && !WcOption.pre_conv &&
Currentbuf->document_charset != DisplayCharset)
str = wtf_conv_fit(str, Currentbuf->document_charset);
else
#endif
str = SearchString;
prevtrap = mySignal(SIGINT, intTrap); prevtrap = mySignal(SIGINT, intTrap);
crmode(); crmode();
if (SETJMP(IntReturn) == 0) { if (SETJMP(IntReturn) == 0) {
@@ -2707,11 +2701,7 @@ DEFUN(reMark, REG_MARK, "Set mark using regexp")
return; return;
} }
} }
#ifdef USE_M17N str = conv_search_string(str, DisplayCharset);
if (SearchConv && !WcOption.pre_conv &&
Currentbuf->document_charset != DisplayCharset)
str = wtf_conv_fit(str, Currentbuf->document_charset);
#endif
if ((str = regexCompile(str, 1)) != NULL) { if ((str = regexCompile(str, 1)) != NULL) {
disp_message(str, TRUE); disp_message(str, TRUE);
return; return;
+4 -17
View File
@@ -1,4 +1,4 @@
/* $Id: menu.c,v 1.40 2003/09/26 20:45:53 ukai Exp $ */ /* $Id: menu.c,v 1.41 2004/03/23 16:44:02 ukai Exp $ */
/* /*
* w3m menu.c * w3m menu.c
*/ */
@@ -954,11 +954,7 @@ menu_search_forward(Menu *menu, int from)
if (str == NULL || *str == '\0') if (str == NULL || *str == '\0')
return -1; return -1;
SearchString = str; SearchString = str;
#ifdef USE_M17N str = conv_search_string(str, DisplayCharset);
if (SearchConv && !WcOption.pre_conv &&
Currentbuf->document_charset != DisplayCharset)
str = wtf_conv_fit(str, Currentbuf->document_charset);
#endif
menuSearchRoutine = menuForwardSearch; menuSearchRoutine = menuForwardSearch;
found = menuForwardSearch(menu, str, from + 1); found = menuForwardSearch(menu, str, from + 1);
if (WrapSearch && found == -1) if (WrapSearch && found == -1)
@@ -1008,11 +1004,7 @@ menu_search_backward(Menu *menu, int from)
if (str == NULL || *str == '\0') if (str == NULL || *str == '\0')
return -1; return -1;
SearchString = str; SearchString = str;
#ifdef USE_M17N str = conv_search_string(str, DisplayCharset);
if (SearchConv && !WcOption.pre_conv &&
Currentbuf->document_charset != DisplayCharset)
str = wtf_conv_fit(str, Currentbuf->document_charset);
#endif
menuSearchRoutine = menuBackwardSearch; menuSearchRoutine = menuBackwardSearch;
found = menuBackwardSearch(menu, str, from - 1); found = menuBackwardSearch(menu, str, from - 1);
if (WrapSearch && found == -1) if (WrapSearch && found == -1)
@@ -1045,12 +1037,7 @@ menu_search_next_previous(Menu *menu, int from, int reverse)
disp_message("No previous regular expression", TRUE); disp_message("No previous regular expression", TRUE);
return -1; return -1;
} }
#ifdef USE_M17N str = conv_search_string(SearchString, DisplayCharset);
str = SearchString;
if (SearchConv && !WcOption.pre_conv &&
Currentbuf->document_charset != DisplayCharset)
str = wtf_conv_fit(str, Currentbuf->document_charset);
#endif
if (reverse != 0) if (reverse != 0)
reverse = 1; reverse = 1;
if (menuSearchRoutine == menuBackwardSearch) if (menuSearchRoutine == menuBackwardSearch)
+6 -1
View File
@@ -1,4 +1,4 @@
/* $Id: proto.h,v 1.97 2003/10/05 18:52:51 ukai Exp $ */ /* $Id: proto.h,v 1.98 2004/03/23 16:44:02 ukai Exp $ */
/* /*
* This file was automatically generated by version 1.7 of cextract. * This file was automatically generated by version 1.7 of cextract.
* Manual editing not recommended. * Manual editing not recommended.
@@ -336,6 +336,11 @@ extern Str correct_irrtag(int status);
#ifdef USE_MIGEMO #ifdef USE_MIGEMO
extern void init_migemo(void); extern void init_migemo(void);
#endif #endif
#ifdef USE_M17N
extern char *conv_search_string(char *str, wc_ces f_ces);
#else
#define conv_search_string(str, f_ces) str
#endif
extern int forwardSearch(Buffer *buf, char *str); extern int forwardSearch(Buffer *buf, char *str);
extern int backwardSearch(Buffer *buf, char *str); extern int backwardSearch(Buffer *buf, char *str);
extern void pcmap(void); extern void pcmap(void);
+14 -2
View File
@@ -1,4 +1,4 @@
/* $Id: search.c,v 1.30 2003/09/22 21:02:21 ukai Exp $ */ /* $Id: search.c,v 1.31 2004/03/23 16:44:02 ukai Exp $ */
#include "fm.h" #include "fm.h"
#include "regex.h" #include "regex.h"
#include <signal.h> #include <signal.h>
@@ -72,7 +72,7 @@ migemostr(char *str)
Strchop(tmp); Strchop(tmp);
if (tmp->length == 0) if (tmp->length == 0)
goto err; goto err;
return tmp->ptr; return conv_search_string(tmp->ptr, SystemCharset);
err: err:
/* XXX: backend migemo is not working? */ /* XXX: backend migemo is not working? */
init_migemo(); init_migemo();
@@ -81,6 +81,18 @@ migemostr(char *str)
} }
#endif /* USE_MIGEMO */ #endif /* USE_MIGEMO */
#ifdef USE_M17N
/* normalize search string */
char *
conv_search_string(char *str, wc_ces f_ces)
{
if (SearchConv && !WcOption.pre_conv &&
Currentbuf->document_charset != f_ces)
str = wtf_conv_fit(str, Currentbuf->document_charset);
return str;
}
#endif
int int
forwardSearch(Buffer *buf, char *str) forwardSearch(Buffer *buf, char *str)
{ {