summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2015-03-01 17:18:45 +0100
committerBoris Faure <billiob@gmail.com>2015-03-01 17:20:18 +0100
commitb4ba773e17027c160667cd5bd7c9dfaf541ff878 (patch)
tree558a191be2f378740370347e954e8449af3f2bb3 /src
parent65d729ce323b72c9e52967d77609e3f1e0df075e (diff)
fix CSI DECSET 1049. Should fix T725
Diffstat (limited to 'src')
-rw-r--r--src/bin/termpty.c3
-rw-r--r--src/bin/termptyesc.c34
2 files changed, 21 insertions, 16 deletions
diff --git a/src/bin/termpty.c b/src/bin/termpty.c
index 1fef59f..f4271a9 100644
--- a/src/bin/termpty.c
+++ b/src/bin/termpty.c
@@ -1101,7 +1101,6 @@ termpty_screen_swap(Termpty *ty)
1101{ 1101{
1102 Termcell *tmp_screen; 1102 Termcell *tmp_screen;
1103 int tmp_circular_offset; 1103 int tmp_circular_offset;
1104 int tmp_appcursor = ty->state.appcursor;
1105 1104
1106 tmp_screen = ty->screen; 1105 tmp_screen = ty->screen;
1107 ty->screen = ty->screen2; 1106 ty->screen = ty->screen2;
@@ -1116,8 +1115,6 @@ termpty_screen_swap(Termpty *ty)
1116 ty->circular_offset = ty->circular_offset2; 1115 ty->circular_offset = ty->circular_offset2;
1117 ty->circular_offset2 = tmp_circular_offset; 1116 ty->circular_offset2 = tmp_circular_offset;
1118 1117
1119 ty->state.appcursor = tmp_appcursor;
1120
1121 ty->altbuf = !ty->altbuf; 1118 ty->altbuf = !ty->altbuf;
1122 1119
1123 if (ty->cb.cancel_sel.func) 1120 if (ty->cb.cancel_sel.func)
diff --git a/src/bin/termptyesc.c b/src/bin/termptyesc.c
index 56cc215..8452d69 100644
--- a/src/bin/termptyesc.c
+++ b/src/bin/termptyesc.c
@@ -110,6 +110,23 @@ _handle_cursor_control(Termpty *ty, const Eina_Unicode *cc)
110} 110}
111 111
112static void 112static void
113_switch_to_alternative_screen(Termpty *ty, int mode)
114{
115 DBG("switch to alternative screen, mode:%d", mode);
116 if (ty->altbuf)
117 {
118 // if we are looking at alt buf now,
119 // clear main buf before we swap it back
120 // into the screen2 save (so save is
121 // clear)
122 _termpty_clear_all(ty);
123 }
124 // swap screen content now
125 if (mode != ty->altbuf)
126 termpty_screen_swap(ty);
127}
128
129static void
113_handle_esc_csi_reset_mode(Termpty *ty, Eina_Unicode cc, Eina_Unicode *b) 130_handle_esc_csi_reset_mode(Termpty *ty, Eina_Unicode cc, Eina_Unicode *b)
114{ 131{
115 int mode = 0, priv = 0, arg; 132 int mode = 0, priv = 0, arg;
@@ -290,26 +307,17 @@ _handle_esc_csi_reset_mode(Termpty *ty, Eina_Unicode cc, Eina_Unicode *b)
290 DBG("Ignored screen mode %i", arg); 307 DBG("Ignored screen mode %i", arg);
291 break; 308 break;
292 case 1047: 309 case 1047:
293 case 1049:
294 case 47: 310 case 47:
295 DBG("DDD: switch buf"); 311 _switch_to_alternative_screen(ty, mode);
296 if (ty->altbuf)
297 {
298 // if we are looking at alt buf now,
299 // clear main buf before we swap it back
300 // into the screen2 save (so save is
301 // clear)
302 _termpty_clear_all(ty);
303 }
304 // swap screen content now
305 if (mode != ty->altbuf)
306 termpty_screen_swap(ty);
307 break; 312 break;
308 case 1048: 313 case 1048:
314 case 1049:
309 if (mode) 315 if (mode)
310 _termpty_cursor_copy(&(ty->state), &(ty->save)); 316 _termpty_cursor_copy(&(ty->state), &(ty->save));
311 else 317 else
312 _termpty_cursor_copy(&(ty->save), &(ty->state)); 318 _termpty_cursor_copy(&(ty->save), &(ty->state));
319 if (arg == 1049)
320 _switch_to_alternative_screen(ty, mode);
313 break; 321 break;
314 case 2004: 322 case 2004:
315 ty->bracketed_paste = mode; 323 ty->bracketed_paste = mode;