To: vim_dev@googlegroups.com Subject: Patch 8.2.4490 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.4490 Problem: Terminal focus reporting only works for xterm-like terminals. (Jonathan Rascher) Solution: Remove the "focus_mode" flag. (closes #9859) Files: src/term.c *** ../vim-8.2.4489/src/term.c 2022-02-13 12:13:13.606245312 +0000 --- src/term.c 2022-02-28 15:10:30.598031402 +0000 *************** *** 197,204 **** static int detected_8bit = FALSE; // detected 8-bit terminal #if (defined(UNIX) || defined(VMS)) ! static int focus_mode = FALSE; // xterm's "focus reporting" availability ! static int focus_state = FALSE; // TRUE if the terminal window gains focus #endif #ifdef FEAT_TERMRESPONSE --- 197,203 ---- static int detected_8bit = FALSE; // detected 8-bit terminal #if (defined(UNIX) || defined(VMS)) ! static int focus_state = MAYBE; // TRUE if the Vim window has focus #endif #ifdef FEAT_TERMRESPONSE *************** *** 2047,2053 **** #endif #ifdef FEAT_MOUSE_XTERM ! // focus reporting is supported by xterm compatible terminals and tmux. if (use_xterm_like_mouse(term)) { char_u name[3]; --- 2046,2052 ---- #endif #ifdef FEAT_MOUSE_XTERM ! // Focus reporting is supported by xterm compatible terminals and tmux. if (use_xterm_like_mouse(term)) { char_u name[3]; *************** *** 2062,2072 **** name[1] = KE_FOCUSLOST; add_termcode(name, (char_u *)"\033[O", FALSE); - focus_mode = TRUE; - focus_state = TRUE; need_gather = TRUE; } #endif #ifdef USE_TERM_CONSOLE // DEFAULT_TERM indicates that it is the machine console. --- 2061,2073 ---- name[1] = KE_FOCUSLOST; add_termcode(name, (char_u *)"\033[O", FALSE); need_gather = TRUE; } #endif + #if (defined(UNIX) || defined(VMS)) + // First time after setting 'term' a focus event is always reported. + focus_state = MAYBE; + #endif #ifdef USE_TERM_CONSOLE // DEFAULT_TERM indicates that it is the machine console. *************** *** 3633,3639 **** #if defined(UNIX) || defined(VMS) // Enable xterm's focus reporting mode when 'esckeys' is set. ! if (focus_mode && p_ek && *T_FE != NUL) out_str(T_FE); #endif --- 3634,3640 ---- #if defined(UNIX) || defined(VMS) // Enable xterm's focus reporting mode when 'esckeys' is set. ! if (p_ek && *T_FE != NUL) out_str(T_FE); #endif *************** *** 3691,3697 **** #if defined(UNIX) || defined(VMS) // Disable xterm's focus reporting mode if 'esckeys' is set. ! if (focus_mode && p_ek && *T_FD != NUL) out_str(T_FD); #endif --- 3692,3698 ---- #if defined(UNIX) || defined(VMS) // Disable xterm's focus reporting mode if 'esckeys' is set. ! if (p_ek && *T_FD != NUL) out_str(T_FD); #endif *************** *** 5812,5822 **** * Handle FocusIn/FocusOut event sequences reported by XTerm. * (CSI I/CSI O) */ ! if (focus_mode # ifdef FEAT_GUI && !gui.in_use # endif - && key_name[0] == KS_EXTRA ) { if (key_name[1] == KE_FOCUSGAINED) --- 5813,5822 ---- * Handle FocusIn/FocusOut event sequences reported by XTerm. * (CSI I/CSI O) */ ! if (key_name[0] == KS_EXTRA # ifdef FEAT_GUI && !gui.in_use # endif ) { if (key_name[1] == KE_FOCUSGAINED) *** ../vim-8.2.4489/src/version.c 2022-03-02 13:13:26.479857967 +0000 --- src/version.c 2022-03-02 17:15:36.187350154 +0000 *************** *** 756,757 **** --- 756,759 ---- { /* Add new patch number below this line */ + /**/ + 4490, /**/ -- I wish there was a knob on the TV to turn up the intelligence. There's a knob called "brightness", but it doesn't seem to work. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///