Support DEC show/hide cursor escapes.

This commit is contained in:
Kevin Lange 2016-09-26 10:14:59 +09:00
parent b46c4f180a
commit 11d0c2d9fe
4 changed files with 25 additions and 47 deletions

View File

@ -311,6 +311,8 @@ static void _ansi_put(term_state_t * s, char c) {
s->mouse_on = 1;
} else if (!strcmp(argv[0], "?1002")) {
s->mouse_on = 2;
} else if (!strcmp(argv[0], "?25")) {
callbacks->set_csr_on(1);
}
}
break;
@ -322,6 +324,8 @@ static void _ansi_put(term_state_t * s, char c) {
s->mouse_on = 0;
} else if (!strcmp(argv[0], "?1002")) {
s->mouse_on = 0;
} else if (!strcmp(argv[0], "?25")) {
callbacks->set_csr_on(0);
}
}
break;

View File

@ -33,6 +33,7 @@ typedef struct {
void (*set_cell_contents)(int,int,char *);
int (*get_cell_width)(void);
int (*get_cell_height)(void);
void (*set_csr_on)(int);
} term_callbacks_t;
typedef struct {

View File

@ -373,26 +373,22 @@ void term_write(char c) {
draw_cursor();
}
void
term_set_csr(int x, int y) {
void term_set_csr(int x, int y) {
cell_redraw(csr_x,csr_y);
csr_x = x;
csr_y = y;
draw_cursor();
}
int
term_get_csr_x() {
int term_get_csr_x() {
return csr_x;
}
int
term_get_csr_y() {
int term_get_csr_y() {
return csr_y;
}
void
term_set_csr_show(uint8_t on) {
void term_set_csr_show(int on) {
cursor_on = on;
}
@ -417,8 +413,7 @@ void flip_cursor() {
cursor_flipped = 1 - cursor_flipped;
}
void
term_set_cell(int x, int y, uint32_t c) {
void term_set_cell(int x, int y, uint32_t c) {
cell_set(x, y, c, current_fg, current_bg, ansi_state->flags);
cell_redraw(x, y);
}
@ -585,33 +580,22 @@ int unsupported_int(void) { return 0; }
void unsupported(int x, int y, char * data) { }
term_callbacks_t term_callbacks = {
/* writer*/
&term_write,
/* set_color*/
&term_set_colors,
/* set_csr*/
&term_set_csr,
/* get_csr_x*/
&term_get_csr_x,
/* get_csr_y*/
&term_get_csr_y,
/* set_cell*/
&term_set_cell,
/* cls*/
&term_clear,
/* scroll*/
&term_scroll,
/* redraw_cursor*/
&term_redraw_cursor,
/* input_buffer_stuff*/
&input_buffer_stuff,
/* set_font_size*/
&set_term_font_size,
/* set_title*/
&set_title,
term_write,
term_set_colors,
term_set_csr,
term_get_csr_x,
term_get_csr_y,
term_set_cell,
term_clear,
term_scroll,
term_redraw_cursor,
input_buffer_stuff,
set_term_font_size,
set_title,
unsupported,
unsupported_int,
unsupported_int,
term_set_csr_show,
};
void reinit(int send_sig) {

View File

@ -778,7 +778,7 @@ int term_get_cell_height(void) {
return char_height;
}
void term_set_csr_show(uint8_t on) {
void term_set_csr_show(int on) {
cursor_on = on;
}
@ -1074,33 +1074,22 @@ void usage(char * argv[]) {
}
term_callbacks_t term_callbacks = {
/* writer*/
&term_write,
/* set_color*/
term_set_colors,
/* set_csr*/
term_set_csr,
/* get_csr_x*/
term_get_csr_x,
/* get_csr_y*/
term_get_csr_y,
/* set_cell*/
term_set_cell,
/* cls*/
term_clear,
/* scroll*/
term_scroll,
/* redraw_cursor*/
term_redraw_cursor,
/* input_buffer_stuff*/
input_buffer_stuff,
/* set_font_size*/
set_term_font_size,
/* set_title*/
set_title,
term_set_cell_contents,
term_get_cell_width,
term_get_cell_height,
term_set_csr_show,
};
void reinit(int send_sig) {