aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2014-04-14 18:39:26 -0400
committerJesse Luehrs <doy@tozt.net>2014-04-14 18:39:26 -0400
commitd13254ad9b7c5d45e8d5092d28b31441606fe5bf (patch)
treebb7dd37d3f5183751a7a599afb3f404804983170
parentf445b28ce574a9529068b096c4be2224198876fb (diff)
downloadrunes-d13254ad9b7c5d45e8d5092d28b31441606fe5bf.tar.gz
runes-d13254ad9b7c5d45e8d5092d28b31441606fe5bf.zip
implement cursor save and restore
-rw-r--r--display.c14
-rw-r--r--display.h2
-rw-r--r--parser.c324
-rw-r--r--parser.l22
-rw-r--r--term.h2
5 files changed, 213 insertions, 151 deletions
diff --git a/display.c b/display.c
index 0084348..bdf0c77 100644
--- a/display.c
+++ b/display.c
@@ -40,6 +40,7 @@ void runes_display_init(RunesTerm *t)
runes_display_reset_text_attributes(t);
runes_display_move_to(t, 0, 0);
+ runes_display_save_cursor(t);
}
void runes_display_set_window_size(RunesTerm *t, int width, int height)
@@ -317,6 +318,19 @@ void runes_display_visual_bell(RunesTerm *t)
runes_window_backend_visual_bell(t);
}
+void runes_display_save_cursor(RunesTerm *t)
+{
+ t->saved_row = t->row;
+ t->saved_col = t->col;
+ /* XXX do other stuff here? */
+}
+
+void runes_display_restore_cursor(RunesTerm *t)
+{
+ t->row = t->saved_row;
+ t->col = t->saved_col;
+}
+
static cairo_scaled_font_t *runes_display_make_font(RunesTerm *t)
{
cairo_font_face_t *font_face;
diff --git a/display.h b/display.h
index ca117d4..4efddef 100644
--- a/display.h
+++ b/display.h
@@ -27,5 +27,7 @@ void runes_display_reset_bg_color(RunesTerm *t);
void runes_display_show_cursor(RunesTerm *t);
void runes_display_hide_cursor(RunesTerm *t);
void runes_display_visual_bell(RunesTerm *t);
+void runes_display_save_cursor(RunesTerm *t);
+void runes_display_restore_cursor(RunesTerm *t);
#endif
diff --git a/parser.c b/parser.c
index 7edf6dc..55e7482 100644
--- a/parser.c
+++ b/parser.c
@@ -351,8 +351,8 @@ static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
*yy_cp = '\0'; \
yyg->yy_c_buf_p = yy_cp;
-#define YY_NUM_RULES 30
-#define YY_END_OF_BUFFER 31
+#define YY_NUM_RULES 32
+#define YY_END_OF_BUFFER 33
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
@@ -360,15 +360,15 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
-static yyconst flex_int16_t yy_accept[66] =
+static yyconst flex_int16_t yy_accept[68] =
{ 0,
- 0, 0, 31, 29, 2, 3, 4, 5, 6, 7,
- 8, 29, 1, 27, 28, 9, 28, 28, 1, 25,
- 25, 25, 25, 10, 11, 12, 13, 14, 15, 16,
- 17, 18, 19, 26, 26, 26, 26, 25, 25, 25,
- 20, 21, 0, 0, 0, 0, 0, 25, 22, 0,
- 23, 0, 24, 0, 25, 25, 0, 0, 0, 0,
- 17, 18, 25, 25, 0
+ 0, 0, 33, 31, 2, 3, 4, 5, 6, 7,
+ 8, 31, 1, 29, 30, 10, 11, 9, 30, 30,
+ 1, 27, 27, 27, 27, 12, 13, 14, 15, 16,
+ 17, 18, 19, 20, 21, 28, 28, 28, 28, 27,
+ 27, 27, 22, 23, 0, 0, 0, 0, 0, 27,
+ 24, 0, 25, 0, 26, 0, 27, 27, 0, 0,
+ 0, 0, 19, 20, 27, 27, 0
} ;
static yyconst flex_int32_t yy_ec[256] =
@@ -378,13 +378,13 @@ static yyconst flex_int32_t yy_ec[256] =
1, 1, 1, 1, 1, 1, 9, 1, 1, 1,
1, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 11, 12, 13,
- 14, 14, 14, 14, 14, 14, 14, 10, 15, 16,
- 16, 10, 17, 10, 18, 19, 20, 21, 10, 10,
- 10, 22, 10, 23, 24, 10, 25, 10, 10, 10,
+ 14, 14, 14, 14, 15, 16, 14, 10, 17, 18,
+ 18, 10, 19, 10, 20, 21, 22, 23, 10, 10,
+ 10, 24, 10, 25, 26, 10, 27, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
- 26, 10, 27, 10, 10, 10, 10, 10, 10, 10,
+ 28, 10, 29, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 28, 10, 10, 10, 29, 30, 10,
+ 10, 10, 10, 30, 10, 10, 10, 31, 32, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 1, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
@@ -403,93 +403,98 @@ static yyconst flex_int32_t yy_ec[256] =
10, 10, 10, 10, 10
} ;
-static yyconst flex_int32_t yy_meta[31] =
+static yyconst flex_int32_t yy_meta[33] =
{ 0,
1, 2, 1, 1, 1, 1, 1, 1, 1, 3,
- 4, 4, 4, 4, 3, 4, 4, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3
+ 4, 4, 4, 4, 4, 4, 3, 5, 5, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3
} ;
-static yyconst flex_int16_t yy_base[78] =
+static yyconst flex_int16_t yy_base[79] =
{ 0,
- 0, 9, 126, 199, 199, 199, 199, 199, 199, 199,
- 199, 18, 0, 199, 199, 199, 45, 17, 0, 199,
- 16, 23, 65, 199, 199, 199, 199, 199, 199, 199,
- 199, 199, 199, 199, 110, 109, 108, 22, 79, 67,
- 199, 199, 120, 119, 117, 98, 72, 24, 199, 116,
- 199, 115, 199, 114, 0, 64, 118, 86, 137, 85,
- 199, 199, 92, 149, 199, 171, 175, 177, 181, 185,
- 111, 188, 191, 194, 110, 83, 38
+ 0, 9, 143, 216, 216, 216, 216, 216, 216, 216,
+ 216, 18, 0, 216, 216, 216, 216, 216, 50, 72,
+ 0, 216, 69, 78, 84, 216, 216, 216, 216, 216,
+ 216, 216, 216, 216, 216, 216, 125, 124, 123, 83,
+ 100, 88, 216, 216, 137, 127, 126, 121, 0, 85,
+ 216, 125, 216, 124, 216, 123, 0, 88, 91, 143,
+ 149, 105, 216, 216, 163, 0, 216, 179, 182, 187,
+ 192, 194, 198, 202, 206, 116, 208, 210
} ;
-static yyconst flex_int16_t yy_def[78] =
+static yyconst flex_int16_t yy_def[79] =
{ 0,
- 66, 66, 65, 65, 65, 65, 65, 65, 65, 65,
- 65, 67, 68, 65, 65, 65, 65, 69, 68, 65,
- 17, 70, 70, 65, 65, 65, 65, 65, 65, 65,
- 65, 65, 65, 65, 65, 65, 65, 71, 70, 23,
- 65, 65, 72, 73, 74, 39, 65, 75, 65, 72,
- 65, 73, 65, 74, 46, 76, 65, 39, 46, 77,
- 65, 65, 39, 46, 0, 65, 65, 65, 65, 65,
- 65, 65, 65, 65, 65, 65, 65
+ 68, 68, 67, 67, 67, 67, 67, 67, 67, 67,
+ 67, 67, 69, 67, 67, 67, 67, 67, 67, 70,
+ 69, 67, 19, 71, 71, 67, 67, 67, 67, 67,
+ 67, 67, 67, 67, 67, 67, 67, 67, 67, 72,
+ 71, 25, 67, 67, 73, 74, 75, 41, 76, 77,
+ 67, 73, 67, 74, 67, 75, 48, 78, 76, 41,
+ 48, 76, 67, 67, 41, 61, 0, 67, 67, 67,
+ 67, 67, 67, 67, 67, 67, 67, 67
} ;
-static yyconst flex_int16_t yy_nxt[230] =
+static yyconst flex_int16_t yy_nxt[249] =
{ 0,
4, 5, 6, 7, 8, 9, 10, 11, 12, 4,
5, 6, 7, 8, 9, 10, 11, 12, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 35, 36, 37,
- 38, 20, 20, 39, 39, 39, 39, 47, 47, 47,
- 47, 57, 16, 17, 18, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 21, 21, 21, 21, 20,
- 22, 23, 24, 25, 26, 27, 28, 29, 30, 20,
- 20, 20, 31, 32, 33, 40, 40, 40, 40, 47,
- 47, 48, 57, 57, 57, 57, 59, 41, 42, 39,
- 39, 39, 39, 48, 31, 32, 63, 63, 63, 63,
-
- 47, 47, 63, 63, 63, 63, 31, 32, 55, 55,
- 55, 55, 56, 58, 46, 53, 51, 49, 53, 28,
- 51, 49, 45, 44, 43, 65, 65, 33, 57, 57,
- 57, 57, 60, 65, 65, 65, 65, 65, 65, 65,
- 65, 65, 65, 65, 65, 61, 62, 64, 64, 64,
- 64, 65, 65, 65, 65, 65, 65, 65, 20, 64,
- 64, 64, 64, 65, 65, 65, 65, 65, 65, 65,
- 20, 13, 13, 13, 13, 15, 15, 15, 15, 19,
- 19, 34, 34, 34, 34, 20, 20, 20, 20, 50,
- 50, 50, 52, 52, 52, 54, 54, 54, 3, 65,
-
- 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
- 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
- 65, 65, 65, 65, 65, 65, 65, 65, 65
+ 14, 14, 14, 14, 14, 14, 14, 15, 15, 15,
+ 15, 15, 16, 17, 15, 15, 15, 15, 15, 15,
+ 15, 15, 15, 15, 18, 19, 20, 15, 15, 15,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 23, 23, 23, 23, 23, 23, 22, 24, 25, 26,
+ 27, 28, 29, 30, 31, 32, 22, 22, 22, 33,
+ 34, 35, 37, 38, 39, 40, 22, 22, 41, 41,
+ 41, 41, 41, 41, 42, 42, 42, 42, 42, 42,
+
+ 49, 49, 49, 49, 50, 49, 49, 62, 43, 44,
+ 41, 41, 41, 41, 41, 41, 50, 33, 34, 59,
+ 63, 64, 49, 49, 55, 53, 51, 55, 53, 33,
+ 34, 57, 57, 57, 57, 57, 57, 58, 51, 47,
+ 46, 45, 67, 67, 30, 67, 67, 67, 67, 67,
+ 67, 67, 35, 65, 65, 65, 65, 65, 65, 66,
+ 66, 66, 66, 66, 66, 67, 67, 67, 67, 67,
+ 67, 67, 22, 65, 65, 65, 65, 65, 65, 13,
+ 13, 13, 13, 13, 21, 21, 21, 36, 36, 36,
+ 36, 36, 22, 22, 22, 22, 22, 48, 48, 52,
+
+ 52, 52, 52, 54, 54, 54, 54, 56, 56, 56,
+ 56, 60, 60, 61, 61, 3, 67, 67, 67, 67,
+ 67, 67, 67, 67, 67, 67, 67, 67, 67, 67,
+ 67, 67, 67, 67, 67, 67, 67, 67, 67, 67,
+ 67, 67, 67, 67, 67, 67, 67, 67
} ;
-static yyconst flex_int16_t yy_chk[230] =
+static yyconst flex_int16_t yy_chk[249] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
2, 2, 2, 2, 2, 2, 2, 2, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 18, 18, 18,
- 21, 21, 21, 22, 22, 22, 22, 38, 38, 48,
- 48, 77, 12, 12, 12, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 23, 23, 23, 23, 56,
- 56, 40, 47, 47, 47, 47, 76, 23, 23, 39,
- 39, 39, 39, 39, 40, 40, 58, 58, 58, 58,
-
- 60, 60, 63, 63, 63, 63, 39, 39, 46, 46,
- 46, 46, 46, 75, 71, 54, 52, 50, 45, 46,
- 44, 43, 37, 36, 35, 3, 0, 46, 57, 57,
- 57, 57, 57, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 57, 57, 59, 59, 59,
- 59, 0, 0, 0, 0, 0, 0, 0, 59, 64,
- 64, 64, 64, 0, 0, 0, 0, 0, 0, 0,
- 64, 66, 66, 66, 66, 67, 67, 67, 67, 68,
- 68, 69, 69, 69, 69, 70, 70, 70, 70, 72,
- 72, 72, 73, 73, 73, 74, 74, 74, 65, 65,
-
- 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
- 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
- 65, 65, 65, 65, 65, 65, 65, 65, 65
+ 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+ 19, 19, 20, 20, 20, 23, 23, 23, 24, 24,
+ 24, 24, 24, 24, 25, 25, 25, 25, 25, 25,
+
+ 40, 40, 50, 50, 42, 58, 58, 59, 25, 25,
+ 41, 41, 41, 41, 41, 41, 41, 42, 42, 76,
+ 59, 59, 62, 62, 56, 54, 52, 47, 46, 41,
+ 41, 48, 48, 48, 48, 48, 48, 48, 45, 39,
+ 38, 37, 3, 0, 48, 0, 0, 0, 0, 0,
+ 0, 0, 48, 60, 60, 60, 60, 60, 60, 61,
+ 61, 61, 61, 61, 61, 0, 0, 0, 0, 0,
+ 0, 0, 61, 65, 65, 65, 65, 65, 65, 68,
+ 68, 68, 68, 68, 69, 69, 69, 70, 70, 70,
+ 70, 70, 71, 71, 71, 71, 71, 72, 72, 73,
+
+ 73, 73, 73, 74, 74, 74, 74, 75, 75, 75,
+ 75, 77, 77, 78, 78, 67, 67, 67, 67, 67,
+ 67, 67, 67, 67, 67, 67, 67, 67, 67, 67,
+ 67, 67, 67, 67, 67, 67, 67, 67, 67, 67,
+ 67, 67, 67, 67, 67, 67, 67, 67
} ;
/* The intent behind this definition is that it'll catch
@@ -509,7 +514,7 @@ static yyconst flex_int16_t yy_chk[230] =
#define YY_EXIT_FAILURE (UNUSED(yyscanner), 2)
#define YY_NO_INPUT 1
-#line 58 "parser.l"
+#line 60 "parser.l"
static void runes_parser_handle_text(RunesTerm *t, char *text, size_t len);
static void runes_parser_handle_bel(RunesTerm *t);
static void runes_parser_handle_bs(RunesTerm *t);
@@ -517,6 +522,8 @@ static void runes_parser_handle_tab(RunesTerm *t);
static void runes_parser_handle_lf(RunesTerm *t);
static void runes_parser_handle_cr(RunesTerm *t);
static void runes_parser_handle_ri(RunesTerm *t);
+static void runes_parser_handle_decsc(RunesTerm *t);
+static void runes_parser_handle_decrc(RunesTerm *t);
static void runes_parser_extract_csi_params(
char *buf, size_t len, int *params, int *nparams);
static void runes_parser_extract_sm_params(
@@ -536,7 +543,7 @@ static void runes_parser_handle_decsel(RunesTerm *t, char *buf, size_t len);
static void runes_parser_handle_osc0(RunesTerm *t, char *buf, size_t len);
static void runes_parser_handle_osc1(RunesTerm *t, char *buf, size_t len);
static void runes_parser_handle_osc2(RunesTerm *t, char *buf, size_t len);
-#line 540 "parser.c"
+#line 547 "parser.c"
#define INITIAL 0
@@ -784,10 +791,10 @@ YY_DECL
}
{
-#line 86 "parser.l"
+#line 90 "parser.l"
-#line 791 "parser.c"
+#line 798 "parser.c"
while ( 1 ) /* loops until end-of-file is reached */
{
@@ -814,13 +821,13 @@ yy_match:
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 66 )
+ if ( yy_current_state >= 68 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
++yy_cp;
}
- while ( yy_current_state != 65 );
+ while ( yy_current_state != 67 );
yy_cp = yyg->yy_last_accepting_cpos;
yy_current_state = yyg->yy_last_accepting_state;
@@ -842,170 +849,180 @@ do_action: /* This label is used only to access EOF actions. */
case 1:
YY_RULE_SETUP
-#line 88 "parser.l"
+#line 92 "parser.l"
runes_parser_handle_text(yyextra, yytext, yyleng);
YY_BREAK
case 2:
YY_RULE_SETUP
-#line 90 "parser.l"
+#line 94 "parser.l"
runes_parser_handle_bel(yyextra);
YY_BREAK
case 3:
YY_RULE_SETUP
-#line 91 "parser.l"
+#line 95 "parser.l"
runes_parser_handle_bs(yyextra);
YY_BREAK
case 4:
YY_RULE_SETUP
-#line 92 "parser.l"
+#line 96 "parser.l"
runes_parser_handle_tab(yyextra);
YY_BREAK
case 5:
/* rule 5 can match eol */
-#line 94 "parser.l"
+#line 98 "parser.l"
case 6:
/* rule 6 can match eol */
-#line 95 "parser.l"
+#line 99 "parser.l"
case 7:
/* rule 7 can match eol */
YY_RULE_SETUP
-#line 95 "parser.l"
+#line 99 "parser.l"
runes_parser_handle_lf(yyextra);
YY_BREAK
case 8:
YY_RULE_SETUP
-#line 96 "parser.l"
+#line 100 "parser.l"
runes_parser_handle_cr(yyextra);
YY_BREAK
case 9:
YY_RULE_SETUP
-#line 98 "parser.l"
+#line 102 "parser.l"
runes_parser_handle_ri(yyextra);
YY_BREAK
case 10:
YY_RULE_SETUP
-#line 100 "parser.l"
-runes_parser_handle_cuu(yyextra, yytext, yyleng);
+#line 103 "parser.l"
+runes_parser_handle_decsc(yyextra);
YY_BREAK
case 11:
YY_RULE_SETUP
-#line 101 "parser.l"
-runes_parser_handle_cud(yyextra, yytext, yyleng);
+#line 104 "parser.l"
+runes_parser_handle_decrc(yyextra);
YY_BREAK
case 12:
YY_RULE_SETUP
-#line 102 "parser.l"
-runes_parser_handle_cuf(yyextra, yytext, yyleng);
+#line 106 "parser.l"
+runes_parser_handle_cuu(yyextra, yytext, yyleng);
YY_BREAK
case 13:
YY_RULE_SETUP
-#line 103 "parser.l"
-runes_parser_handle_cub(yyextra, yytext, yyleng);
+#line 107 "parser.l"
+runes_parser_handle_cud(yyextra, yytext, yyleng);
YY_BREAK
case 14:
YY_RULE_SETUP
-#line 104 "parser.l"
-runes_parser_handle_cup(yyextra, yytext, yyleng);
+#line 108 "parser.l"
+runes_parser_handle_cuf(yyextra, yytext, yyleng);
YY_BREAK
case 15:
YY_RULE_SETUP
-#line 105 "parser.l"
-runes_parser_handle_ed(yyextra, yytext, yyleng);
+#line 109 "parser.l"
+runes_parser_handle_cub(yyextra, yytext, yyleng);
YY_BREAK
case 16:
YY_RULE_SETUP
-#line 106 "parser.l"
-runes_parser_handle_el(yyextra, yytext, yyleng);
+#line 110 "parser.l"
+runes_parser_handle_cup(yyextra, yytext, yyleng);
YY_BREAK
case 17:
YY_RULE_SETUP
-#line 107 "parser.l"
-runes_parser_handle_sm(yyextra, yytext, yyleng);
+#line 111 "parser.l"
+runes_parser_handle_ed(yyextra, yytext, yyleng);
YY_BREAK
case 18:
YY_RULE_SETUP
-#line 108 "parser.l"
-runes_parser_handle_rm(yyextra, yytext, yyleng);
+#line 112 "parser.l"
+runes_parser_handle_el(yyextra, yytext, yyleng);
YY_BREAK
case 19:
YY_RULE_SETUP
-#line 109 "parser.l"
-runes_parser_handle_sgr(yyextra, yytext, yyleng);
+#line 113 "parser.l"
+runes_parser_handle_sm(yyextra, yytext, yyleng);
YY_BREAK
case 20:
YY_RULE_SETUP
-#line 111 "parser.l"
-runes_parser_handle_decsed(yyextra, yytext, yyleng);
+#line 114 "parser.l"
+runes_parser_handle_rm(yyextra, yytext, yyleng);
YY_BREAK
case 21:
YY_RULE_SETUP
-#line 112 "parser.l"
-runes_parser_handle_decsel(yyextra, yytext, yyleng);
+#line 115 "parser.l"
+runes_parser_handle_sgr(yyextra, yytext, yyleng);
YY_BREAK
case 22:
YY_RULE_SETUP
-#line 114 "parser.l"
-runes_parser_handle_osc0(yyextra, yytext, yyleng);
+#line 117 "parser.l"
+runes_parser_handle_decsed(yyextra, yytext, yyleng);
YY_BREAK
case 23:
YY_RULE_SETUP
-#line 115 "parser.l"
-runes_parser_handle_osc1(yyextra, yytext, yyleng);
+#line 118 "parser.l"
+runes_parser_handle_decsel(yyextra, yytext, yyleng);
YY_BREAK
case 24:
YY_RULE_SETUP
-#line 116 "parser.l"
-runes_parser_handle_osc2(yyextra, yytext, yyleng);
+#line 120 "parser.l"
+runes_parser_handle_osc0(yyextra, yytext, yyleng);
YY_BREAK
case 25:
YY_RULE_SETUP
-#line 118 "parser.l"
+#line 121 "parser.l"
+runes_parser_handle_osc1(yyextra, yytext, yyleng);
+ YY_BREAK
+case 26:
+YY_RULE_SETUP
+#line 122 "parser.l"
+runes_parser_handle_osc2(yyextra, yytext, yyleng);
+ YY_BREAK
+case 27:
+YY_RULE_SETUP
+#line 124 "parser.l"
{
fprintf(
stderr, "unhandled CSI sequence: \\033%*s\n",
(int)yyleng - 1, yytext + 1);
}
YY_BREAK
-case 26:
+case 28:
YY_RULE_SETUP
-#line 124 "parser.l"
+#line 130 "parser.l"
{
fprintf(
stderr, "unhandled OSC sequence: \\033%*s\n",
(int)yyleng - 1, yytext + 1);
}
YY_BREAK
-case 27:
-/* rule 27 can match eol */
+case 29:
+/* rule 29 can match eol */
YY_RULE_SETUP
-#line 130 "parser.l"
+#line 136 "parser.l"
{
fprintf(stderr, "unhandled escape sequence: \\%hho\n", yytext[1]);
yyless(1);
}
YY_BREAK
-case 28:
+case 30:
YY_RULE_SETUP
-#line 135 "parser.l"
+#line 141 "parser.l"
{
fprintf(stderr, "unhandled escape sequence: %c\n", yytext[1]);
yyless(1);
}
YY_BREAK
-case 29:
-/* rule 29 can match eol */
+case 31:
+/* rule 31 can match eol */
YY_RULE_SETUP
-#line 140 "parser.l"
+#line 146 "parser.l"
{
fprintf(stderr, "unhandled control character: \\%hho\n", yytext[0]);
}
YY_BREAK
-case 30:
+case 32:
YY_RULE_SETUP
-#line 144 "parser.l"
+#line 150 "parser.l"
YY_FATAL_ERROR( "flex scanner jammed" );
YY_BREAK
-#line 1009 "parser.c"
+#line 1026 "parser.c"
case YY_STATE_EOF(INITIAL):
yyterminate();
@@ -1301,7 +1318,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 66 )
+ if ( yy_current_state >= 68 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1330,11 +1347,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 66 )
+ if ( yy_current_state >= 68 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
- yy_is_jam = (yy_current_state == 65);
+ yy_is_jam = (yy_current_state == 67);
(void)yyg;
return yy_is_jam ? 0 : yy_current_state;
@@ -2099,7 +2116,7 @@ static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
#define YYTABLES_NAME "yytables"
-#line 144 "parser.l"
+#line 150 "parser.l"
@@ -2125,7 +2142,8 @@ static void runes_parser_handle_text(RunesTerm *t, char *text, size_t len)
static void runes_parser_handle_bel(RunesTerm *t)
{
- runes_display_visual_bell(t);
+ /* XXX */
+ UNUSED(t);
}
static void runes_parser_handle_bs(RunesTerm *t)
@@ -2153,6 +2171,16 @@ static void runes_parser_handle_ri(RunesTerm *t)
runes_display_move_to(t, t->row - 1, t->col);
}
+static void runes_parser_handle_decsc(RunesTerm *t)
+{
+ runes_display_save_cursor(t);
+}
+
+static void runes_parser_handle_decrc(RunesTerm *t)
+{
+ runes_display_restore_cursor(t);
+}
+
static void runes_parser_extract_csi_params(
char *buf, size_t len, int *params, int *nparams)
{
diff --git a/parser.l b/parser.l
index a525d8f..0fb8c1d 100644
--- a/parser.l
+++ b/parser.l
@@ -26,9 +26,11 @@ FF \014
CR \015
ESC \033
-CSI {ESC}\[
-OSC {ESC}\]
-RI {ESC}M
+CSI {ESC}\[
+OSC {ESC}\]
+RI {ESC}M
+DECSC {ESC}7
+DECRC {ESC}8
DECCSI {CSI}\?
CSIPARAM1 ([0-9]+)?
@@ -62,6 +64,8 @@ static void runes_parser_handle_tab(RunesTerm *t);
static void runes_parser_handle_lf(RunesTerm *t);
static void runes_parser_handle_cr(RunesTerm *t);
static void runes_parser_handle_ri(RunesTerm *t);
+static void runes_parser_handle_decsc(RunesTerm *t);
+static void runes_parser_handle_decrc(RunesTerm *t);
static void runes_parser_extract_csi_params(
char *buf, size_t len, int *params, int *nparams);
static void runes_parser_extract_sm_params(
@@ -96,6 +100,8 @@ static void runes_parser_handle_osc2(RunesTerm *t, char *buf, size_t len);
{CR} runes_parser_handle_cr(yyextra);
{RI} runes_parser_handle_ri(yyextra);
+{DECSC} runes_parser_handle_decsc(yyextra);
+{DECRC} runes_parser_handle_decrc(yyextra);
{CUU} runes_parser_handle_cuu(yyextra, yytext, yyleng);
{CUD} runes_parser_handle_cud(yyextra, yytext, yyleng);
@@ -194,6 +200,16 @@ static void runes_parser_handle_ri(RunesTerm *t)
runes_display_move_to(t, t->row - 1, t->col);
}
+static void runes_parser_handle_decsc(RunesTerm *t)
+{
+ runes_display_save_cursor(t);
+}
+
+static void runes_parser_handle_decrc(RunesTerm *t)
+{
+ runes_display_restore_cursor(t);
+}
+
static void runes_parser_extract_csi_params(
char *buf, size_t len, int *params, int *nparams)
{
diff --git a/term.h b/term.h
index a62821b..4813097 100644
--- a/term.h
+++ b/term.h
@@ -26,6 +26,8 @@ struct runes_term {
int row;
int col;
+ int saved_row;
+ int saved_col;
int rows;
int cols;