w3m

Unnamed repository; edit this file to name it for gitweb.
git clone https://logand.com/git/w3m.git/
Log | Files | Refs | README

commit 4772731e72808dfc2609bfe66bd477da6b25af05
parent a3379e05a0855bfd45b188594db2576a817d55fb
Author: ukai <ukai>
Date:   Tue, 23 Mar 2004 16:44:02 +0000

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>

Diffstat:
MChangeLog | 14+++++++++++++-
Mmain.c | 14++------------
Mmenu.c | 19+++----------------
Mproto.h | 5+++++
Msearch.c | 14+++++++++++++-
5 files changed, 36 insertions(+), 30 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -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 diff --git a/main.c b/main.c @@ -1604,13 +1604,7 @@ srchcore(char *volatile str, int (*func) (Buffer *, char *)) if (SearchString == NULL || *SearchString == '\0') return SR_NOTFOUND; -#ifdef USE_M17N - if (SearchConv && !WcOption.pre_conv && - Currentbuf->document_charset != DisplayCharset) - str = wtf_conv_fit(str, Currentbuf->document_charset); - else -#endif - str = SearchString; + str = conv_search_string(SearchString, DisplayCharset); prevtrap = mySignal(SIGINT, intTrap); crmode(); if (SETJMP(IntReturn) == 0) { @@ -2707,11 +2701,7 @@ DEFUN(reMark, REG_MARK, "Set mark using regexp") return; } } -#ifdef USE_M17N - if (SearchConv && !WcOption.pre_conv && - Currentbuf->document_charset != DisplayCharset) - str = wtf_conv_fit(str, Currentbuf->document_charset); -#endif + str = conv_search_string(str, DisplayCharset); if ((str = regexCompile(str, 1)) != NULL) { disp_message(str, TRUE); return; diff --git a/menu.c b/menu.c @@ -954,11 +954,7 @@ menu_search_forward(Menu *menu, int from) if (str == NULL || *str == '\0') return -1; SearchString = str; -#ifdef USE_M17N - if (SearchConv && !WcOption.pre_conv && - Currentbuf->document_charset != DisplayCharset) - str = wtf_conv_fit(str, Currentbuf->document_charset); -#endif + str = conv_search_string(str, DisplayCharset); menuSearchRoutine = menuForwardSearch; found = menuForwardSearch(menu, str, from + 1); if (WrapSearch && found == -1) @@ -1008,11 +1004,7 @@ menu_search_backward(Menu *menu, int from) if (str == NULL || *str == '\0') return -1; SearchString = str; -#ifdef USE_M17N - if (SearchConv && !WcOption.pre_conv && - Currentbuf->document_charset != DisplayCharset) - str = wtf_conv_fit(str, Currentbuf->document_charset); -#endif + str = conv_search_string(str, DisplayCharset); menuSearchRoutine = menuBackwardSearch; found = menuBackwardSearch(menu, str, from - 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); return -1; } -#ifdef USE_M17N - str = SearchString; - if (SearchConv && !WcOption.pre_conv && - Currentbuf->document_charset != DisplayCharset) - str = wtf_conv_fit(str, Currentbuf->document_charset); -#endif + str = conv_search_string(SearchString, DisplayCharset); if (reverse != 0) reverse = 1; if (menuSearchRoutine == menuBackwardSearch) diff --git a/proto.h b/proto.h @@ -336,6 +336,11 @@ extern Str correct_irrtag(int status); #ifdef USE_MIGEMO extern void init_migemo(void); #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 backwardSearch(Buffer *buf, char *str); extern void pcmap(void); diff --git a/search.c b/search.c @@ -72,7 +72,7 @@ migemostr(char *str) Strchop(tmp); if (tmp->length == 0) goto err; - return tmp->ptr; + return conv_search_string(tmp->ptr, SystemCharset); err: /* XXX: backend migemo is not working? */ init_migemo(); @@ -81,6 +81,18 @@ migemostr(char *str) } #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 forwardSearch(Buffer *buf, char *str) {