@@ -902,6 +902,7 @@ chafa_term_sync_probe (ChafaTerm *term, gint timeout_ms)
902
902
struct termios saved_termios ;
903
903
gboolean termios_changed = FALSE;
904
904
#endif
905
+ gint printed_len = 0 ;
905
906
906
907
if (term -> probe_success )
907
908
return TRUE;
@@ -917,14 +918,21 @@ chafa_term_sync_probe (ChafaTerm *term, gint timeout_ms)
917
918
ensure_raw_mode_enabled (term , & saved_termios , & termios_changed );
918
919
#endif
919
920
920
- chafa_term_print_seq (term , CHAFA_TERM_SEQ_QUERY_DEFAULT_FG , -1 );
921
- chafa_term_print_seq (term , CHAFA_TERM_SEQ_QUERY_DEFAULT_BG , -1 );
922
- chafa_term_print_seq (term , CHAFA_TERM_SEQ_QUERY_TEXT_AREA_SIZE_CELLS , -1 );
923
- chafa_term_print_seq (term , CHAFA_TERM_SEQ_QUERY_TEXT_AREA_SIZE_PX , -1 );
924
- chafa_term_print_seq (term , CHAFA_TERM_SEQ_QUERY_CELL_SIZE_PX , -1 );
925
- chafa_term_print_seq (term , CHAFA_TERM_SEQ_QUERY_PRIMARY_DEVICE_ATTRIBUTES , -1 );
921
+ printed_len += chafa_term_print_seq (term , CHAFA_TERM_SEQ_QUERY_DEFAULT_FG , -1 );
922
+ printed_len += chafa_term_print_seq (term , CHAFA_TERM_SEQ_QUERY_DEFAULT_BG , -1 );
923
+ printed_len += chafa_term_print_seq (term , CHAFA_TERM_SEQ_QUERY_TEXT_AREA_SIZE_CELLS , -1 );
924
+ printed_len += chafa_term_print_seq (term , CHAFA_TERM_SEQ_QUERY_TEXT_AREA_SIZE_PX , -1 );
925
+ printed_len += chafa_term_print_seq (term , CHAFA_TERM_SEQ_QUERY_CELL_SIZE_PX , -1 );
926
+ printed_len += chafa_term_print_seq (term , CHAFA_TERM_SEQ_QUERY_PRIMARY_DEVICE_ATTRIBUTES , -1 );
926
927
term -> probe_attempt = TRUE;
927
928
929
+ if (printed_len == 0 )
930
+ {
931
+ /* Terminal doesn't support any of the probe sequences */
932
+ term -> probe_success = FALSE;
933
+ return FALSE;
934
+ }
935
+
928
936
while ((event = in_sync_pull (term , timeout_ms > 0 ? remain_ms : -1 )))
929
937
{
930
938
g_queue_push_head (term -> event_queue , event );
0 commit comments