copilot-cli icon indicating copy to clipboard operation
copilot-cli copied to clipboard

Enhance copilot to enable reporting focus, respond to entering and exiting focus

Open andyfeller opened this issue 2 months ago • 0 comments

Describe the feature or problem you'd like to solve

Terminal multiplexers like tmux and screen allow users to work with multiple virtual terminals at the same time. Sighted users can find it difficult understanding the current focus: From @ljones140: > Really silly question. > Is there a way for the copilot cli to indicate when my tmux cursor is on the the pane? > My setup is tmux and neovim. Copilot still has the cursor when I've actually moved the "real" cursor to another pane. From @jakewilkins: > fwiw I also am interested in this. My go-to way of finding my cursor if I switch back to a tmux session and I'm not sure is "jkjkjkjkjk" and then copilot starts contemplating the meaning of that :sweat_smile: It's just me trying to move the vim cursor and then see if it's in a shell instead

Proposed solution

Ideally, copilot would enable and react to reporting focus events based on ANSI escape codes, changing the display of the cursor appropriately:

  • CSI ? 1004 h: Enable reporting focus. Reports whenever terminal emulator enters or exits focus
  • ESC [I: enter focus
  • ESC [O: exit focus
Sequence Code Description Behavior
ESC [ 0 SP q DECSCUSR User Shape Default cursor shape configured by the user
ESC [ 1 SP q DECSCUSR Blinking Block Blinking block cursor shape
ESC [ 2 SP q DECSCUSR Steady Block Steady block cursor shape
ESC [ 3 SP q DECSCUSR Blinking Underline Blinking underline cursor shape
ESC [ 4 SP q DECSCUSR Steady Underline Steady underline cursor shape
ESC [ 5 SP q DECSCUSR Blinking Bar Blinking bar cursor shape
ESC [ 6 SP q DECSCUSR Steady Bar Steady bar cursor shape

Example prompts or workflows

No response

Additional context

andyfeller avatar Nov 03 '25 18:11 andyfeller