Lines Matching refs:state

53 static bool lookup_colour_ansi(const VTermState *state, long index, VTermColor *col)  in lookup_colour_ansi()  argument
56 *col = state->colors[index]; in lookup_colour_ansi()
63 static bool lookup_colour_palette(const VTermState *state, long index, VTermColor *col) in lookup_colour_palette() argument
67 return lookup_colour_ansi(state, index, col); in lookup_colour_palette()
91 static int lookup_colour(const VTermState *state, int palette, const long args[], int argcount, VTe… in lookup_colour() argument
119 static void setpenattr(VTermState *state, VTermAttr attr, VTermValueType type, VTermValue *val) in setpenattr() argument
128 if(state->callbacks && state->callbacks->setpenattr) in setpenattr()
129 (*state->callbacks->setpenattr)(attr, val, state->cbdata); in setpenattr()
132 static void setpenattr_bool(VTermState *state, VTermAttr attr, int boolean) in setpenattr_bool() argument
135 setpenattr(state, attr, VTERM_VALUETYPE_BOOL, &val); in setpenattr_bool()
138 static void setpenattr_int(VTermState *state, VTermAttr attr, int number) in setpenattr_int() argument
141 setpenattr(state, attr, VTERM_VALUETYPE_INT, &val); in setpenattr_int()
144 static void setpenattr_col(VTermState *state, VTermAttr attr, VTermColor color) in setpenattr_col() argument
147 setpenattr(state, attr, VTERM_VALUETYPE_COLOR, &val); in setpenattr_col()
150 static void set_pen_col_ansi(VTermState *state, VTermAttr attr, long col) in set_pen_col_ansi() argument
152 VTermColor *colp = (attr == VTERM_ATTR_BACKGROUND) ? &state->pen.bg : &state->pen.fg; in set_pen_col_ansi()
156 setpenattr_col(state, attr, *colp); in set_pen_col_ansi()
159 INTERNAL void vterm_state_newpen(VTermState *state) in vterm_state_newpen() argument
162 vterm_color_rgb(&state->default_fg, 240, 240, 240); in vterm_state_newpen()
163 vterm_color_rgb(&state->default_bg, 0, 0, 0); in vterm_state_newpen()
164 vterm_state_set_default_colors(state, &state->default_fg, &state->default_bg); in vterm_state_newpen()
167 lookup_default_colour_ansi(col, &state->colors[col]); in vterm_state_newpen()
170 INTERNAL void vterm_state_resetpen(VTermState *state) in vterm_state_resetpen() argument
172 state->pen.bold = 0; setpenattr_bool(state, VTERM_ATTR_BOLD, 0); in vterm_state_resetpen()
173 state->pen.underline = 0; setpenattr_int( state, VTERM_ATTR_UNDERLINE, 0); in vterm_state_resetpen()
174 state->pen.italic = 0; setpenattr_bool(state, VTERM_ATTR_ITALIC, 0); in vterm_state_resetpen()
175 state->pen.blink = 0; setpenattr_bool(state, VTERM_ATTR_BLINK, 0); in vterm_state_resetpen()
176 state->pen.reverse = 0; setpenattr_bool(state, VTERM_ATTR_REVERSE, 0); in vterm_state_resetpen()
177 state->pen.strike = 0; setpenattr_bool(state, VTERM_ATTR_STRIKE, 0); in vterm_state_resetpen()
178 state->pen.font = 0; setpenattr_int( state, VTERM_ATTR_FONT, 0); in vterm_state_resetpen()
180state->pen.fg = state->default_fg; setpenattr_col(state, VTERM_ATTR_FOREGROUND, state->default_fg… in vterm_state_resetpen()
181state->pen.bg = state->default_bg; setpenattr_col(state, VTERM_ATTR_BACKGROUND, state->default_bg… in vterm_state_resetpen()
184 INTERNAL void vterm_state_savepen(VTermState *state, int save) in vterm_state_savepen() argument
187 state->saved.pen = state->pen; in vterm_state_savepen()
190 state->pen = state->saved.pen; in vterm_state_savepen()
192 setpenattr_bool(state, VTERM_ATTR_BOLD, state->pen.bold); in vterm_state_savepen()
193 setpenattr_int( state, VTERM_ATTR_UNDERLINE, state->pen.underline); in vterm_state_savepen()
194 setpenattr_bool(state, VTERM_ATTR_ITALIC, state->pen.italic); in vterm_state_savepen()
195 setpenattr_bool(state, VTERM_ATTR_BLINK, state->pen.blink); in vterm_state_savepen()
196 setpenattr_bool(state, VTERM_ATTR_REVERSE, state->pen.reverse); in vterm_state_savepen()
197 setpenattr_bool(state, VTERM_ATTR_STRIKE, state->pen.strike); in vterm_state_savepen()
198 setpenattr_int( state, VTERM_ATTR_FONT, state->pen.font); in vterm_state_savepen()
199 setpenattr_col( state, VTERM_ATTR_FOREGROUND, state->pen.fg); in vterm_state_savepen()
200 setpenattr_col( state, VTERM_ATTR_BACKGROUND, state->pen.bg); in vterm_state_savepen()
224 void vterm_state_get_default_colors(const VTermState *state, VTermColor *default_fg, VTermColor *de… in vterm_state_get_default_colors() argument
226 *default_fg = state->default_fg; in vterm_state_get_default_colors()
227 *default_bg = state->default_bg; in vterm_state_get_default_colors()
230 void vterm_state_get_palette_color(const VTermState *state, int index, VTermColor *col) in vterm_state_get_palette_color() argument
232 lookup_colour_palette(state, index, col); in vterm_state_get_palette_color()
235 void vterm_state_set_default_colors(VTermState *state, const VTermColor *default_fg, const VTermCol… in vterm_state_set_default_colors() argument
238 state->default_fg = *default_fg; in vterm_state_set_default_colors()
239 state->default_bg = *default_bg; in vterm_state_set_default_colors()
242 state->default_fg.type = (state->default_fg.type & ~VTERM_COLOR_DEFAULT_MASK) in vterm_state_set_default_colors()
244 state->default_bg.type = (state->default_bg.type & ~VTERM_COLOR_DEFAULT_MASK) in vterm_state_set_default_colors()
248 void vterm_state_set_palette_color(VTermState *state, int index, const VTermColor *col) in vterm_state_set_palette_color() argument
251 state->colors[index] = *col; in vterm_state_set_palette_color()
254 void vterm_state_convert_color_to_rgb(const VTermState *state, VTermColor *col) in vterm_state_convert_color_to_rgb() argument
257 lookup_colour_palette(state, col->indexed.idx, col); in vterm_state_convert_color_to_rgb()
262 void vterm_state_set_bold_highbright(VTermState *state, int bold_is_highbright) in vterm_state_set_bold_highbright() argument
264 state->bold_is_highbright = bold_is_highbright; in vterm_state_set_bold_highbright()
267 INTERNAL void vterm_state_setpen(VTermState *state, const long args[], int argcount) in vterm_state_setpen() argument
283 vterm_state_resetpen(state); in vterm_state_setpen()
287 const VTermColor *fg = &state->pen.fg; in vterm_state_setpen()
288 state->pen.bold = 1; in vterm_state_setpen()
289 setpenattr_bool(state, VTERM_ATTR_BOLD, 1); in vterm_state_setpen()
290 …IS_DEFAULT_FG(fg) && VTERM_COLOR_IS_INDEXED(fg) && fg->indexed.idx < 8 && state->bold_is_highbrigh… in vterm_state_setpen()
291 set_pen_col_ansi(state, VTERM_ATTR_FOREGROUND, fg->indexed.idx + (state->pen.bold ? 8 : 0)); in vterm_state_setpen()
296 state->pen.italic = 1; in vterm_state_setpen()
297 setpenattr_bool(state, VTERM_ATTR_ITALIC, 1); in vterm_state_setpen()
301 state->pen.underline = 1; in vterm_state_setpen()
302 setpenattr_int(state, VTERM_ATTR_UNDERLINE, 1); in vterm_state_setpen()
306 state->pen.blink = 1; in vterm_state_setpen()
307 setpenattr_bool(state, VTERM_ATTR_BLINK, 1); in vterm_state_setpen()
311 state->pen.reverse = 1; in vterm_state_setpen()
312 setpenattr_bool(state, VTERM_ATTR_REVERSE, 1); in vterm_state_setpen()
316 state->pen.strike = 1; in vterm_state_setpen()
317 setpenattr_bool(state, VTERM_ATTR_STRIKE, 1); in vterm_state_setpen()
322 state->pen.font = CSI_ARG(args[argi]) - 10; in vterm_state_setpen()
323 setpenattr_int(state, VTERM_ATTR_FONT, state->pen.font); in vterm_state_setpen()
327 state->pen.underline = 2; in vterm_state_setpen()
328 setpenattr_int(state, VTERM_ATTR_UNDERLINE, 2); in vterm_state_setpen()
332 state->pen.bold = 0; in vterm_state_setpen()
333 setpenattr_bool(state, VTERM_ATTR_BOLD, 0); in vterm_state_setpen()
337 state->pen.italic = 0; in vterm_state_setpen()
338 setpenattr_bool(state, VTERM_ATTR_ITALIC, 0); in vterm_state_setpen()
342 state->pen.underline = 0; in vterm_state_setpen()
343 setpenattr_int(state, VTERM_ATTR_UNDERLINE, 0); in vterm_state_setpen()
347 state->pen.blink = 0; in vterm_state_setpen()
348 setpenattr_bool(state, VTERM_ATTR_BLINK, 0); in vterm_state_setpen()
352 state->pen.reverse = 0; in vterm_state_setpen()
353 setpenattr_bool(state, VTERM_ATTR_REVERSE, 0); in vterm_state_setpen()
357 state->pen.strike = 0; in vterm_state_setpen()
358 setpenattr_bool(state, VTERM_ATTR_STRIKE, 0); in vterm_state_setpen()
364 if(state->pen.bold && state->bold_is_highbright) in vterm_state_setpen()
366 set_pen_col_ansi(state, VTERM_ATTR_FOREGROUND, value); in vterm_state_setpen()
372 …argi += 1 + lookup_colour(state, CSI_ARG(args[argi+1]), args+argi+2, argcount-argi-2, &state->pen.… in vterm_state_setpen()
373 setpenattr_col(state, VTERM_ATTR_FOREGROUND, state->pen.fg); in vterm_state_setpen()
377 state->pen.fg = state->default_fg; in vterm_state_setpen()
378 setpenattr_col(state, VTERM_ATTR_FOREGROUND, state->pen.fg); in vterm_state_setpen()
384 set_pen_col_ansi(state, VTERM_ATTR_BACKGROUND, value); in vterm_state_setpen()
390 …argi += 1 + lookup_colour(state, CSI_ARG(args[argi+1]), args+argi+2, argcount-argi-2, &state->pen.… in vterm_state_setpen()
391 setpenattr_col(state, VTERM_ATTR_BACKGROUND, state->pen.bg); in vterm_state_setpen()
395 state->pen.bg = state->default_bg; in vterm_state_setpen()
396 setpenattr_col(state, VTERM_ATTR_BACKGROUND, state->pen.bg); in vterm_state_setpen()
402 set_pen_col_ansi(state, VTERM_ATTR_FOREGROUND, value); in vterm_state_setpen()
408 set_pen_col_ansi(state, VTERM_ATTR_BACKGROUND, value); in vterm_state_setpen()
456 INTERNAL int vterm_state_getpen(VTermState *state, long args[], int argcount) in vterm_state_getpen() argument
460 if(state->pen.bold) in vterm_state_getpen()
463 if(state->pen.italic) in vterm_state_getpen()
466 if(state->pen.underline == 1) in vterm_state_getpen()
469 if(state->pen.blink) in vterm_state_getpen()
472 if(state->pen.reverse) in vterm_state_getpen()
475 if(state->pen.strike) in vterm_state_getpen()
478 if(state->pen.font) in vterm_state_getpen()
479 args[argi++] = 10 + state->pen.font; in vterm_state_getpen()
481 if(state->pen.underline == 2) in vterm_state_getpen()
484 argi = vterm_state_getpen_color(&state->pen.fg, argi, args, true); in vterm_state_getpen()
486 argi = vterm_state_getpen_color(&state->pen.bg, argi, args, false); in vterm_state_getpen()
491 int vterm_state_get_penattr(const VTermState *state, VTermAttr attr, VTermValue *val) in vterm_state_get_penattr() argument
495 val->boolean = state->pen.bold; in vterm_state_get_penattr()
499 val->number = state->pen.underline; in vterm_state_get_penattr()
503 val->boolean = state->pen.italic; in vterm_state_get_penattr()
507 val->boolean = state->pen.blink; in vterm_state_get_penattr()
511 val->boolean = state->pen.reverse; in vterm_state_get_penattr()
515 val->boolean = state->pen.strike; in vterm_state_get_penattr()
519 val->number = state->pen.font; in vterm_state_get_penattr()
523 val->color = state->pen.fg; in vterm_state_get_penattr()
527 val->color = state->pen.bg; in vterm_state_get_penattr()