commit b6d0ffceff0432ebc89cc8cf759a85725b91560c
parent f8f807615d59cae7c49a78669a51650b6ea52b65
Author: htrb <htrb>
Date: Mon, 19 Jul 2010 12:08:41 +0000
* [w3m-dev 04321] Re: w3m's bugs from bugs.debian.org
* http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=261174#10
* terms.c (graph_ok): check UseGraphicChar is GRAPHIC_CHAR_ALL or not.
* symbol.c (get_symbol): check UseGraphicChar.
* rc.c (graphic_char_str): added.
* main.c (sig_chld): use GRAPHIC_CHAR_ASCII and GRAPHIC_CHAR_ALL.
* fm.h (GRAPHIC_CHAR_ASCII, GRAPHIC_CHAR_CHARSET, GRAPHIC_CHAR_ALL): added.
* fm.h: UseGraphicChar is initialized as GRAPHIC_CHAR_ASCII.
Diffstat:
6 files changed, 48 insertions(+), 22 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,6 +1,17 @@
2010-07-19 d+w3m@vdr.jp
* [w3m-dev 04321] Re: w3m's bugs from bugs.debian.org
+ * http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=261174#10
+ * terms.c (graph_ok): check UseGraphicChar is GRAPHIC_CHAR_ALL or not.
+ * symbol.c (get_symbol): check UseGraphicChar.
+ * rc.c (graphic_char_str): added.
+ * main.c (sig_chld): use GRAPHIC_CHAR_ASCII and GRAPHIC_CHAR_ALL.
+ * fm.h (GRAPHIC_CHAR_ASCII, GRAPHIC_CHAR_CHARSET, GRAPHIC_CHAR_ALL): added.
+ * fm.h: UseGraphicChar is initialized as GRAPHIC_CHAR_ASCII.
+
+2010-07-19 d+w3m@vdr.jp
+
+ * [w3m-dev 04321] Re: w3m's bugs from bugs.debian.org
* http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=185006#22
* main.c (sig_chld): save exit code to d->err.
(addDownloadList): initialize d->running and d->err.
diff --git a/fm.h b/fm.h
@@ -1057,7 +1057,10 @@ global char SimplePreserveSpace init(FALSE);
#define wc_Str_conv_strict(x,charset0,charset1) (x)
#endif
global char UseAltEntity init(TRUE);
-global char UseGraphicChar init(FALSE);
+#define GRAPHIC_CHAR_ASCII 2
+#define GRAPHIC_CHAR_CHARSET 0
+#define GRAPHIC_CHAR_ALL 1
+global char UseGraphicChar init(GRAPHIC_CHAR_ASCII);
extern char *graph_symbol[];
extern char *graph2_symbol[];
extern int symbol_width;
diff --git a/main.c b/main.c
@@ -562,9 +562,9 @@ main(int argc, char **argv, char **envp)
}
#endif
else if (!strcmp("-graph", argv[i]))
- UseGraphicChar = TRUE;
+ UseGraphicChar = GRAPHIC_CHAR_ALL;
else if (!strcmp("-no-graph", argv[i]))
- UseGraphicChar = FALSE;
+ UseGraphicChar = GRAPHIC_CHAR_ASCII;
else if (!strcmp("-T", argv[i])) {
if (++i >= argc)
usage();
diff --git a/rc.c b/rc.c
@@ -331,6 +331,13 @@ static struct sel_c auto_detect_str[] = {
};
#endif
+static struct sel_c graphic_char_str[] = {
+ {N_S(GRAPHIC_CHAR_ASCII), N_("No")},
+ {N_S(GRAPHIC_CHAR_CHARSET), N_("Yes, but only charset specific")},
+ {N_S(GRAPHIC_CHAR_ALL), N_("Yes")},
+ {0, NULL, NULL}
+};
+
struct param_ptr params1[] = {
{"tabstop", P_NZINT, PI_TEXT, (void *)&Tabstop, CMT_TABSTOP, NULL},
{"indent_incr", P_NZINT, PI_TEXT, (void *)&IndentIncr, CMT_INDENT_INCR,
@@ -365,8 +372,8 @@ struct param_ptr params1[] = {
{"multicol", P_INT, PI_ONOFF, (void *)&multicolList, CMT_MULTICOL, NULL},
{"alt_entity", P_CHARINT, PI_ONOFF, (void *)&UseAltEntity, CMT_ALT_ENTITY,
NULL},
- {"graphic_char", P_CHARINT, PI_ONOFF, (void *)&UseGraphicChar,
- CMT_GRAPHIC_CHAR, NULL},
+ {"graphic_char", P_CHARINT, PI_SEL_C, (void *)&UseGraphicChar,
+ CMT_GRAPHIC_CHAR, (void *)graphic_char_str},
{"fold_textarea", P_CHARINT, PI_ONOFF, (void *)&FoldTextarea,
CMT_FOLD_TEXTAREA, NULL},
{"display_ins_del", P_INT, PI_SEL_C, (void *)&displayInsDel,
diff --git a/symbol.c b/symbol.c
@@ -86,24 +86,29 @@ get_symbol(wc_ces charset, int *width)
charset_symbol_set *p;
symbol_set *s = NULL;
- if (charset == save_charset && save_symbol != NULL &&
- *width == save_symbol->width) {
- *width = save_symbol->width;
- return save_symbol->item;
- }
- save_charset = charset;
- for (p = charset_symbol_list; p->charset; p++) {
- if (charset == p->charset &&
- (*width == 0 || *width == p->symbol->width)) {
- s = p->symbol;
- break;
+ if (UseGraphicChar != GRAPHIC_CHAR_ASCII) {
+ if (charset == save_charset && save_symbol != NULL &&
+ *width == save_symbol->width)
+ return save_symbol->item;
+ save_charset = charset;
+ for (p = charset_symbol_list; p->charset; p++) {
+ if (charset == p->charset &&
+ (*width == 0 || *width == p->symbol->width)) {
+ s = p->symbol;
+ break;
+ }
}
- }
- if (s == NULL)
+ if (s == NULL)
+ s = (*width == 2) ? &alt2_symbol_set : &alt_symbol_set;
+ if (s != save_symbol) {
+ if (!s->encode)
+ encode_symbol(s);
+ save_symbol = s;
+ }
+ } else {
+ if (save_symbol != NULL && *width == save_symbol->width)
+ return save_symbol->item;
s = (*width == 2) ? &alt2_symbol_set : &alt_symbol_set;
- if (s != save_symbol) {
- if (!s->encode)
- encode_symbol(s);
save_symbol = s;
}
*width = s->width;
diff --git a/terms.c b/terms.c
@@ -1201,7 +1201,7 @@ graphend(void)
int
graph_ok(void)
{
- if (!UseGraphicChar)
+ if (UseGraphicChar != GRAPHIC_CHAR_ALL)
return 0;
return T_as[0] != 0 && T_ae[0] != 0 && T_ac[0] != 0;
}