package w3m
tag 261174 patch
thanks

On Sat, Jul 24, 2004 at 07:49:59AM +0800, Dan Jacobson wrote:
> There should be a way to have -dump dump table borders drawn with
> ASCII characters without having to use LC_ALL=C.  If I use LC_ALL=C,
> it messes up the Chinese content.
> 
The attached patch restricts table and menu borders to ASCII if you use
the -no-graph command line option.

Regards,
-- 
Karsten Schölzel        | Email:  [EMAIL PROTECTED]
Väderleden 9 4:98       | Jabber: [EMAIL PROTECTED]
97633 Luleå             | VoIP:   sip:[EMAIL PROTECTED]
Sweden                  |         sip:[EMAIL PROTECTED]
                        | Tel:    +4918015855857712
Make it possible to restrict table and menu borders to ASCII characters.
This is now done with -no-graph and the old meaning of -no-graph is
accessible through -o graphic_char=0
The values of graphic_char now have a strange order to be compatible with
older configs. It might be better to make the order natural.

---
commit 6c8cdf8e614ff121ef3d378fa305f16119410c37
tree 1b0e471b7e00d9a9c2ace2875a7ca4c0f269b012
parent 1c2e64c5ba38727f991c9787b95067391a4a0907
author Karsten Schoelzel <[EMAIL PROTECTED]> Thu, 04 May 2006 20:38:22 +0200
committer Karsten Schoelzel <[EMAIL PROTECTED]> Thu, 04 May 2006 20:38:22 +0200

 fm.h     |    5 ++++-
 main.c   |    4 ++--
 rc.c     |   11 +++++++++--
 symbol.c |   37 +++++++++++++++++++++----------------
 terms.c  |    2 +-
 5 files changed, 37 insertions(+), 22 deletions(-)

diff --git a/fm.h b/fm.h
index e10c2a7..8b8244b 100644
--- a/fm.h
+++ b/fm.h
@@ -1038,7 +1038,10 @@ global char SearchConv init(TRUE);
 #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
index 6e11806..98d783e 100644
--- a/main.c
+++ b/main.c
@@ -544,9 +544,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
index 5d009bb..17f30d8 100644
--- a/rc.c
+++ b/rc.c
@@ -332,6 +332,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,
@@ -368,8 +375,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_ONOFF, (void *)&displayInsDel,
diff --git a/symbol.c b/symbol.c
index 9a482b3..7c235f2 100644
--- 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
index ed9f425..5fa0568 100644
--- a/terms.c
+++ b/terms.c
@@ -1157,7 +1157,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;
 }

Reply via email to