It is enabled by private mode 1004 (added to xterm in 2007, patch #224): CSI ? Pm h When the terminal gains focus, and CSI O when it loses focus. Only one can have focus there are protocols for establishing how to gain and lose focus in a graphical environment which it would not be helpful to explore.įrom the description (see also Tmux current pane indicator when focus regained), it appears that iTerm2 implements this xterm feature:įocusIn/FocusOut can be combined with any of the mouse events since it The term "focus" refers to which terminal (or window) is currently accepting keyboard and mouse input events. with alias focusfix='printf "\e[?1004l"') to make it more convenient to run manually. If you're concerned about your shell always generating that output, perhaps because you sometimes use it in places that don't handle those control codes well, or if the problem is sometimes triggered after the shell starts up, then you might prefer to set up an alias (e.g. There doesn't appear to be any harm (under XTerm at least) to sending the control code if the feature is already disabled, so it should be safe even if you only see this problem sometimes. I personally only see this problem if I've inadvertently dumped binary output to the terminal, but if you're encountering it more regularly you might want to add that printf to your shell's interactive startup script (e.g. Repeat the " run xeyes, switch focus" steps above, but this time see no characters being entered in the terminal.Now close Xeyes, return to the original XTerm, and run printf "\e[?1004l" (to disable the feature, as described in the fix above).by clicking on windows) and see ^[[O and ^[[I being "typed" into the original XTerm. Repeatedly switch focus into and out of the original XTerm (e.g.(For some reason, this effect does not happen for me until the XTerm in question launches an application. Run xeyes or some other GUI application from that same XTerm.Run xterm and enable the feature by running printf "\e[?1004h" in it.On Linux I can demonstrate this control sequence working with the following steps: It should solve your problem in all applications, not just Vim, by stopping the characters from occurring at all. This ANSI control sequence is like the one listed in Thomas Dickey's answer, but it turns the feature off (rather than on). (Note that the last character there is a lower-case 'ell'.) Run the following shell command inside the terminal where you're seeing the problem: printf "\e[?1004l" I don't have a Mac handy to test this answer, but I encounter this problem in XTerm under Linux very occasionally and (assuming iTerm2 respects the same control codes) you might find the fix below helpful.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |