0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 9.0.0776: MSVC can't have field name "small"

Problem:    MSVC can't have field name "small".
Solution:   Rename small to smallfont.
This commit is contained in:
Bram Moolenaar
2022-10-16 20:24:16 +01:00
parent 2a46f81ec7
commit 9d8620b519
7 changed files with 27 additions and 25 deletions

View File

@@ -528,7 +528,7 @@ typedef struct {
unsigned int font : 4; /* 0 to 9 */ unsigned int font : 4; /* 0 to 9 */
unsigned int dwl : 1; /* On a DECDWL or DECDHL line */ unsigned int dwl : 1; /* On a DECDWL or DECDHL line */
unsigned int dhl : 2; /* On a DECDHL line (1=top 2=bottom) */ unsigned int dhl : 2; /* On a DECDHL line (1=top 2=bottom) */
unsigned int small : 1; unsigned int smallfont : 1;
unsigned int baseline : 2; unsigned int baseline : 2;
} VTermScreenCellAttrs; } VTermScreenCellAttrs;

View File

@@ -181,7 +181,7 @@ INTERNAL void vterm_state_resetpen(VTermState *state)
state->pen.conceal = 0; setpenattr_bool(state, VTERM_ATTR_CONCEAL, 0); state->pen.conceal = 0; setpenattr_bool(state, VTERM_ATTR_CONCEAL, 0);
state->pen.strike = 0; setpenattr_bool(state, VTERM_ATTR_STRIKE, 0); state->pen.strike = 0; setpenattr_bool(state, VTERM_ATTR_STRIKE, 0);
state->pen.font = 0; setpenattr_int (state, VTERM_ATTR_FONT, 0); state->pen.font = 0; setpenattr_int (state, VTERM_ATTR_FONT, 0);
state->pen.small = 0; setpenattr_bool(state, VTERM_ATTR_SMALL, 0); state->pen.smallfont = 0; setpenattr_bool(state, VTERM_ATTR_SMALL, 0);
state->pen.baseline = 0; setpenattr_int (state, VTERM_ATTR_BASELINE, 0); state->pen.baseline = 0; setpenattr_int (state, VTERM_ATTR_BASELINE, 0);
state->pen.fg = state->default_fg; setpenattr_col(state, VTERM_ATTR_FOREGROUND, state->default_fg); state->pen.fg = state->default_fg; setpenattr_col(state, VTERM_ATTR_FOREGROUND, state->default_fg);
@@ -204,7 +204,7 @@ INTERNAL void vterm_state_savepen(VTermState *state, int save)
setpenattr_bool(state, VTERM_ATTR_CONCEAL, state->pen.conceal); setpenattr_bool(state, VTERM_ATTR_CONCEAL, state->pen.conceal);
setpenattr_bool(state, VTERM_ATTR_STRIKE, state->pen.strike); setpenattr_bool(state, VTERM_ATTR_STRIKE, state->pen.strike);
setpenattr_int (state, VTERM_ATTR_FONT, state->pen.font); setpenattr_int (state, VTERM_ATTR_FONT, state->pen.font);
setpenattr_bool(state, VTERM_ATTR_SMALL, state->pen.small); setpenattr_bool(state, VTERM_ATTR_SMALL, state->pen.smallfont);
setpenattr_int (state, VTERM_ATTR_BASELINE, state->pen.baseline); setpenattr_int (state, VTERM_ATTR_BASELINE, state->pen.baseline);
setpenattr_col( state, VTERM_ATTR_FOREGROUND, state->pen.fg); setpenattr_col( state, VTERM_ATTR_FOREGROUND, state->pen.fg);
@@ -454,12 +454,12 @@ INTERNAL void vterm_state_setpen(VTermState *state, const long args[], int argco
case 73: // Superscript case 73: // Superscript
case 74: // Subscript case 74: // Subscript
case 75: // Superscript/subscript off case 75: // Superscript/subscript off
state->pen.small = (arg != 75); state->pen.smallfont = (arg != 75);
state->pen.baseline = state->pen.baseline =
(arg == 73) ? VTERM_BASELINE_RAISE : (arg == 73) ? VTERM_BASELINE_RAISE :
(arg == 74) ? VTERM_BASELINE_LOWER : (arg == 74) ? VTERM_BASELINE_LOWER :
VTERM_BASELINE_NORMAL; VTERM_BASELINE_NORMAL;
setpenattr_bool(state, VTERM_ATTR_SMALL, state->pen.small); setpenattr_bool(state, VTERM_ATTR_SMALL, state->pen.smallfont);
setpenattr_int (state, VTERM_ATTR_BASELINE, state->pen.baseline); setpenattr_int (state, VTERM_ATTR_BASELINE, state->pen.baseline);
break; break;
@@ -560,7 +560,7 @@ INTERNAL int vterm_state_getpen(VTermState *state, long args[], int argcount UNU
argi = vterm_state_getpen_color(&state->pen.bg, argi, args, FALSE); argi = vterm_state_getpen_color(&state->pen.bg, argi, args, FALSE);
if(state->pen.small) { if(state->pen.smallfont) {
if(state->pen.baseline == VTERM_BASELINE_RAISE) if(state->pen.baseline == VTERM_BASELINE_RAISE)
args[argi++] = 73; args[argi++] = 73;
else if(state->pen.baseline == VTERM_BASELINE_LOWER) else if(state->pen.baseline == VTERM_BASELINE_LOWER)
@@ -614,7 +614,7 @@ int vterm_state_get_penattr(const VTermState *state, VTermAttr attr, VTermValue
return 1; return 1;
case VTERM_ATTR_SMALL: case VTERM_ATTR_SMALL:
val->boolean = state->pen.small; val->boolean = state->pen.smallfont;
return 1; return 1;
case VTERM_ATTR_BASELINE: case VTERM_ATTR_BASELINE:

View File

@@ -35,13 +35,13 @@ static int rect_equal(VTermRect *a, VTermRect *b)
(a->end_col == b->end_col); (a->end_col == b->end_col);
} }
/* True if small is contained entirely within big */ /* True if smallrect is contained entirely within big */
static int rect_contains(VTermRect *big, VTermRect *small) static int rect_contains(VTermRect *big, VTermRect *smallrect)
{ {
if(small->start_row < big->start_row) return 0; if(smallrect->start_row < big->start_row) return 0;
if(small->start_col < big->start_col) return 0; if(smallrect->start_col < big->start_col) return 0;
if(small->end_row > big->end_row) return 0; if(smallrect->end_row > big->end_row) return 0;
if(small->end_col > big->end_col) return 0; if(smallrect->end_col > big->end_col) return 0;
return 1; return 1;
} }

View File

@@ -26,7 +26,7 @@ typedef struct
unsigned int conceal : 1; unsigned int conceal : 1;
unsigned int strike : 1; unsigned int strike : 1;
unsigned int font : 4; /* 0 to 9 */ unsigned int font : 4; /* 0 to 9 */
unsigned int small : 1; unsigned int smallfont : 1;
unsigned int baseline : 2; unsigned int baseline : 2;
/* Extra state storage that isn't strictly pen-related */ /* Extra state storage that isn't strictly pen-related */
@@ -446,7 +446,7 @@ static int setpenattr(VTermAttr attr, VTermValue *val, void *user)
screen->pen.bg = val->color; screen->pen.bg = val->color;
return 1; return 1;
case VTERM_ATTR_SMALL: case VTERM_ATTR_SMALL:
screen->pen.small = val->boolean; screen->pen.smallfont = val->boolean;
return 1; return 1;
case VTERM_ATTR_BASELINE: case VTERM_ATTR_BASELINE:
screen->pen.baseline = val->number; screen->pen.baseline = val->number;
@@ -700,7 +700,7 @@ static void resize_buffer(VTermScreen *screen, int bufidx, int new_rows, int new
dst->pen.conceal = src->attrs.conceal; dst->pen.conceal = src->attrs.conceal;
dst->pen.strike = src->attrs.strike; dst->pen.strike = src->attrs.strike;
dst->pen.font = src->attrs.font; dst->pen.font = src->attrs.font;
dst->pen.small = src->attrs.small; dst->pen.smallfont = src->attrs.smallfont;
dst->pen.baseline = src->attrs.baseline; dst->pen.baseline = src->attrs.baseline;
dst->pen.fg = src->fg; dst->pen.fg = src->fg;
@@ -1014,7 +1014,7 @@ int vterm_screen_get_cell(const VTermScreen *screen, VTermPos pos, VTermScreenCe
cell->attrs.conceal = intcell->pen.conceal; cell->attrs.conceal = intcell->pen.conceal;
cell->attrs.strike = intcell->pen.strike; cell->attrs.strike = intcell->pen.strike;
cell->attrs.font = intcell->pen.font; cell->attrs.font = intcell->pen.font;
cell->attrs.small = intcell->pen.small; cell->attrs.smallfont = intcell->pen.smallfont;
cell->attrs.baseline = intcell->pen.baseline; cell->attrs.baseline = intcell->pen.baseline;
cell->attrs.dwl = intcell->pen.dwl; cell->attrs.dwl = intcell->pen.dwl;
@@ -1158,7 +1158,7 @@ static int attrs_differ(VTermAttrMask attrs, ScreenCell *a, ScreenCell *b)
return 1; return 1;
if((attrs & VTERM_ATTR_BACKGROUND_MASK) && !vterm_color_is_equal(&a->pen.bg, &b->pen.bg)) if((attrs & VTERM_ATTR_BACKGROUND_MASK) && !vterm_color_is_equal(&a->pen.bg, &b->pen.bg))
return 1; return 1;
if((attrs & VTERM_ATTR_SMALL_MASK) && (a->pen.small != b->pen.small)) if((attrs & VTERM_ATTR_SMALL_MASK) && (a->pen.smallfont != b->pen.smallfont))
return 1; return 1;
if((attrs & VTERM_ATTR_BASELINE_MASK) && (a->pen.baseline != b->pen.baseline)) if((attrs & VTERM_ATTR_BASELINE_MASK) && (a->pen.baseline != b->pen.baseline))
return 1; return 1;

View File

@@ -60,7 +60,7 @@ struct VTermPen
unsigned int conceal:1; unsigned int conceal:1;
unsigned int strike:1; unsigned int strike:1;
unsigned int font:4; /* To store 0-9 */ unsigned int font:4; /* To store 0-9 */
unsigned int small:1; unsigned int smallfont:1;
unsigned int baseline:2; unsigned int baseline:2;
}; };

View File

@@ -410,7 +410,7 @@ static struct {
int conceal; int conceal;
int strike; int strike;
int font; int font;
int small; int smallfont;
int baseline; int baseline;
VTermColor foreground; VTermColor foreground;
VTermColor background; VTermColor background;
@@ -443,7 +443,7 @@ static int state_setpenattr(VTermAttr attr, VTermValue *val, void *user UNUSED)
state_pen.font = val->number; state_pen.font = val->number;
break; break;
case VTERM_ATTR_SMALL: case VTERM_ATTR_SMALL:
state_pen.small = val->boolean; state_pen.smallfont = val->boolean;
break; break;
case VTERM_ATTR_BASELINE: case VTERM_ATTR_BASELINE:
state_pen.baseline = val->number; state_pen.baseline = val->number;
@@ -1015,11 +1015,11 @@ int main(int argc UNUSED, char **argv UNUSED)
} }
else if(streq(linep, "small")) { else if(streq(linep, "small")) {
vterm_state_get_penattr(state, VTERM_ATTR_SMALL, &val); vterm_state_get_penattr(state, VTERM_ATTR_SMALL, &val);
if(val.boolean != state_pen.small) if(val.boolean != state_pen.smallfont)
printf("! pen small mismatch; state=%s, event=%s\n", printf("! pen small mismatch; state=%s, event=%s\n",
BOOLSTR(val.boolean), BOOLSTR(state_pen.small)); BOOLSTR(val.boolean), BOOLSTR(state_pen.smallfont));
else else
printf("%s\n", BOOLSTR(state_pen.small)); printf("%s\n", BOOLSTR(state_pen.smallfont));
} }
else if(streq(linep, "baseline")) { else if(streq(linep, "baseline")) {
vterm_state_get_penattr(state, VTERM_ATTR_BASELINE, &val); vterm_state_get_penattr(state, VTERM_ATTR_BASELINE, &val);
@@ -1160,7 +1160,7 @@ int main(int argc UNUSED, char **argv UNUSED)
if(cell.attrs.blink) printf("K"); if(cell.attrs.blink) printf("K");
if(cell.attrs.reverse) printf("R"); if(cell.attrs.reverse) printf("R");
if(cell.attrs.font) printf("F%d", cell.attrs.font); if(cell.attrs.font) printf("F%d", cell.attrs.font);
if(cell.attrs.small) printf("S"); if(cell.attrs.smallfont) printf("S");
if(cell.attrs.baseline) printf( if(cell.attrs.baseline) printf(
cell.attrs.baseline == VTERM_BASELINE_RAISE ? "^" : cell.attrs.baseline == VTERM_BASELINE_RAISE ? "^" :
"_"); "_");

View File

@@ -695,6 +695,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
776,
/**/ /**/
775, 775,
/**/ /**/