diff --git a/include/vterm.h b/include/vterm.h index 7c06ba8b..9a76c498 100644 --- a/include/vterm.h +++ b/include/vterm.h @@ -259,6 +259,7 @@ typedef enum { VTERM_PROP_REVERSE, // bool VTERM_PROP_CURSORSHAPE, // number VTERM_PROP_MOUSE, // number + VTERM_PROP_FOCUSREPORT, // bool VTERM_N_PROPS } VTermProp; diff --git a/src/state.c b/src/state.c index 2a67b88a..ce8e0342 100644 --- a/src/state.c +++ b/src/state.c @@ -801,6 +801,7 @@ static void set_dec_mode(VTermState *state, int num, int val) break; case 1004: + settermprop_bool(state, VTERM_PROP_FOCUSREPORT, val); state->mode.report_focus = val; break; @@ -2224,6 +2225,9 @@ int vterm_state_set_termprop(VTermState *state, VTermProp prop, VTermValue *val) if(val->number == VTERM_PROP_MOUSE_MOVE) state->mouse_flags |= MOUSE_WANT_MOVE; return 1; + case VTERM_PROP_FOCUSREPORT: + state->mode.report_focus = val->boolean; + return 1; case VTERM_N_PROPS: return 0; diff --git a/src/vterm.c b/src/vterm.c index 0997887f..e1f676f5 100644 --- a/src/vterm.c +++ b/src/vterm.c @@ -295,6 +295,7 @@ VTermValueType vterm_get_prop_type(VTermProp prop) case VTERM_PROP_REVERSE: return VTERM_VALUETYPE_BOOL; case VTERM_PROP_CURSORSHAPE: return VTERM_VALUETYPE_INT; case VTERM_PROP_MOUSE: return VTERM_VALUETYPE_INT; + case VTERM_PROP_FOCUSREPORT: return VTERM_VALUETYPE_BOOL; case VTERM_N_PROPS: return 0; } diff --git a/t/25state_input.test b/t/25state_input.test index 4eb4c6ab..11013ed9 100644 --- a/t/25state_input.test +++ b/t/25state_input.test @@ -148,7 +148,9 @@ FOCUS IN FOCUS OUT !Focus reporting enabled +WANTSTATE +p PUSH "\e[?1004h" + settermprop 9 true FOCUS IN output "\e[I" FOCUS OUT