New option disable_center to disable center alignment
Bug-Debian: https://github.com/tats/w3m/issues/175 Bug-Debian: https://github.com/tats/w3m/issues/185
This commit is contained in:
@@ -4319,7 +4319,10 @@ set_alignment(struct readbuffer *obuf, struct parsed_tag *tag)
|
||||
if (parsedtag_get_value(tag, ATTR_ALIGN, &align)) {
|
||||
switch (align) {
|
||||
case ALIGN_CENTER:
|
||||
flag = RB_CENTER;
|
||||
if (DisableCenter)
|
||||
flag = RB_LEFT;
|
||||
else
|
||||
flag = RB_CENTER;
|
||||
break;
|
||||
case ALIGN_RIGHT:
|
||||
flag = RB_RIGHT;
|
||||
@@ -5183,7 +5186,10 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
|
||||
if (!(obuf->flag & (RB_PREMODE | RB_IGNORE_P)))
|
||||
flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit);
|
||||
RB_SAVE_FLAG(obuf);
|
||||
RB_SET_ALIGN(obuf, RB_CENTER);
|
||||
if (DisableCenter)
|
||||
RB_SET_ALIGN(obuf, RB_LEFT);
|
||||
else
|
||||
RB_SET_ALIGN(obuf, RB_CENTER);
|
||||
return 1;
|
||||
case HTML_N_CENTER:
|
||||
CLOSE_A;
|
||||
|
||||
@@ -677,7 +677,7 @@ struct readbuffer {
|
||||
#define RB_HTML5 0x400000
|
||||
|
||||
#define RB_GET_ALIGN(obuf) ((obuf)->flag&RB_ALIGN)
|
||||
#define RB_SET_ALIGN(obuf,align) {(obuf)->flag &= ~RB_ALIGN; (obuf)->flag |= (align); }
|
||||
#define RB_SET_ALIGN(obuf,align) do{(obuf)->flag &= ~RB_ALIGN; (obuf)->flag |= (align); }while(0)
|
||||
#define RB_SAVE_FLAG(obuf) {\
|
||||
if ((obuf)->flag_sp < RB_STACK_SIZE) \
|
||||
(obuf)->flag_stack[(obuf)->flag_sp++] = RB_GET_ALIGN(obuf); \
|
||||
@@ -1125,6 +1125,7 @@ global char UseAltEntity init(FALSE);
|
||||
#define GRAPHIC_CHAR_CHARSET 0
|
||||
global char UseGraphicChar init(GRAPHIC_CHAR_CHARSET);
|
||||
global char DisplayBorders init(FALSE);
|
||||
global char DisableCenter init(FALSE);
|
||||
extern char *graph_symbol[];
|
||||
extern char *graph2_symbol[];
|
||||
extern int symbol_width;
|
||||
|
||||
@@ -92,6 +92,7 @@ static int OptionEncode = FALSE;
|
||||
#define CMT_ALT_ENTITY N_("Use ASCII equivalents to display entities")
|
||||
#define CMT_GRAPHIC_CHAR N_("Character type for border of table and menu")
|
||||
#define CMT_DISP_BORDERS N_("Display table borders, ignore value of BORDER")
|
||||
#define CMT_DISABLE_CENTER N_("Disable center alignment")
|
||||
#define CMT_FOLD_TEXTAREA N_("Fold lines in TEXTAREA")
|
||||
#define CMT_DISP_INS_DEL N_("Display INS, DEL, S and STRIKE element")
|
||||
#define CMT_COLOR N_("Display with color")
|
||||
@@ -422,6 +423,8 @@ struct param_ptr params1[] = {
|
||||
CMT_GRAPHIC_CHAR, (void *)graphic_char_str},
|
||||
{"display_borders", P_CHARINT, PI_ONOFF, (void *)&DisplayBorders,
|
||||
CMT_DISP_BORDERS, NULL},
|
||||
{"disable_center", P_CHARINT, PI_ONOFF, (void *)&DisableCenter,
|
||||
CMT_DISABLE_CENTER, NULL},
|
||||
{"fold_textarea", P_CHARINT, PI_ONOFF, (void *)&FoldTextarea,
|
||||
CMT_FOLD_TEXTAREA, NULL},
|
||||
{"display_ins_del", P_INT, PI_SEL_C, (void *)&displayInsDel,
|
||||
|
||||
@@ -616,12 +616,17 @@ print_item(struct table *t, int row, int col, int width, Str buf)
|
||||
alignment = ALIGN_RIGHT;
|
||||
else if ((t->tabattr[row][col] & HTT_ALIGN) == HTT_CENTER)
|
||||
alignment = ALIGN_CENTER;
|
||||
if (DisableCenter && alignment == ALIGN_CENTER)
|
||||
alignment = ALIGN_LEFT;
|
||||
align(lbuf, width, alignment);
|
||||
Strcat(buf, lbuf->line);
|
||||
}
|
||||
else {
|
||||
lbuf = newTextLine(NULL, 0);
|
||||
align(lbuf, width, ALIGN_CENTER);
|
||||
if (DisableCenter)
|
||||
align(lbuf, width, ALIGN_LEFT);
|
||||
else
|
||||
align(lbuf, width, ALIGN_CENTER);
|
||||
Strcat(buf, lbuf->line);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user