summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2017-06-05 21:04:29 +0200
committerBoris Faure <billiob@gmail.com>2017-06-05 21:04:29 +0200
commitbbfa60120ea6978982e95ef12f77e4b98fa1a02a (patch)
tree277d9b3d52fe959ec0267441bc0caa42d47bc1fe
parent9f72ea3a9dcb69ae47046cdd0d4c6fe156b57c4c (diff)
termpty: handle DECERA
-rw-r--r--src/bin/termptyesc.c77
1 files changed, 63 insertions, 14 deletions
diff --git a/src/bin/termptyesc.c b/src/bin/termptyesc.c
index cb2aa21..cead2ce 100644
--- a/src/bin/termptyesc.c
+++ b/src/bin/termptyesc.c
@@ -825,21 +825,17 @@ bad:
825 ty->termstate.bottom_margin = 0; 825 ty->termstate.bottom_margin = 0;
826} 826}
827 827
828static void 828static int
829_handle_esc_csi_decfra(Termpty *ty, Eina_Unicode **b) 829_clean_up_rect_coordinates(Termpty *ty,
830 int *top_ptr,
831 int *left_ptr,
832 int *bottom_ptr,
833 int *right_ptr)
830{ 834{
831 int c = _csi_arg_get(b); 835 int top = *top_ptr;
832 836 int left = *left_ptr;
833 int top = _csi_arg_get(b); 837 int bottom = *bottom_ptr;
834 int left = _csi_arg_get(b); 838 int right = *right_ptr;
835 int bottom = _csi_arg_get(b);
836 int right = _csi_arg_get(b);
837 int len;
838
839 DBG("DECFRA (%d; %d;%d;%d;%d) Fill Rectangular Area",
840 c, top, left, bottom, right);
841 if (! ((c >= 32 && c <= 126) || (c >= 160 && c <= 255)))
842 return;
843 839
844 TERMPTY_RESTRICT_FIELD(top, 1, ty->h); 840 TERMPTY_RESTRICT_FIELD(top, 1, ty->h);
845 top--; 841 top--;
@@ -871,6 +867,33 @@ _handle_esc_csi_decfra(Termpty *ty, Eina_Unicode **b)
871 bottom--; 867 bottom--;
872 868
873 if ((bottom < top) || (right < left)) 869 if ((bottom < top) || (right < left))
870 return -1;
871
872 *top_ptr = top;
873 *left_ptr = left;
874 *bottom_ptr = bottom;
875 *right_ptr = right;
876
877 return 0;
878}
879
880static void
881_handle_esc_csi_decfra(Termpty *ty, Eina_Unicode **b)
882{
883 int c = _csi_arg_get(b);
884
885 int top = _csi_arg_get(b);
886 int left = _csi_arg_get(b);
887 int bottom = _csi_arg_get(b);
888 int right = _csi_arg_get(b);
889 int len;
890
891 DBG("DECFRA (%d; %d;%d;%d;%d) Fill Rectangular Area",
892 c, top, left, bottom, right);
893 if (! ((c >= 32 && c <= 126) || (c >= 160 && c <= 255)))
894 return;
895
896 if (_clean_up_rect_coordinates(ty, &top, &left, &bottom, &right) < 0)
874 return; 897 return;
875 898
876 len = right - left; 899 len = right - left;
@@ -883,6 +906,29 @@ _handle_esc_csi_decfra(Termpty *ty, Eina_Unicode **b)
883} 906}
884 907
885static void 908static void
909_handle_esc_csi_decera(Termpty *ty, Eina_Unicode **b)
910{
911 int top = _csi_arg_get(b);
912 int left = _csi_arg_get(b);
913 int bottom = _csi_arg_get(b);
914 int right = _csi_arg_get(b);
915 int len;
916
917 DBG("DECERA (%d;%d;%d;%d) Erase Rectangular Area",
918 top, left, bottom, right);
919
920 if (_clean_up_rect_coordinates(ty, &top, &left, &bottom, &right) < 0)
921 return;
922
923 len = right - left;
924 for (; top <= bottom; top++)
925 {
926 Termcell *cells = &(TERMPTY_SCREEN(ty, left, top));
927 termpty_cells_clear(ty, cells, len);
928 }
929}
930
931static void
886_handle_esc_csi_cursor_pos_set(Termpty *ty, Eina_Unicode **b, 932_handle_esc_csi_cursor_pos_set(Termpty *ty, Eina_Unicode **b,
887 const Eina_Unicode *cc) 933 const Eina_Unicode *cc)
888{ 934{
@@ -1296,6 +1342,9 @@ _handle_esc_csi(Termpty *ty, const Eina_Unicode *c, Eina_Unicode *ce)
1296 TERMPTY_RESTRICT_FIELD(ty->cursor_state.cx, 0, ty->w); 1342 TERMPTY_RESTRICT_FIELD(ty->cursor_state.cx, 0, ty->w);
1297 } 1343 }
1298 break; 1344 break;
1345 case 'z':
1346 _handle_esc_csi_decera(ty, &b);
1347 break;
1299 case 'I': 1348 case 'I':
1300 arg = _csi_arg_get(&b); 1349 arg = _csi_arg_get(&b);
1301 TERMPTY_RESTRICT_FIELD(arg, 1, ty->w); 1350 TERMPTY_RESTRICT_FIELD(arg, 1, ty->w);