Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues related to fish shell when window focus is switched #4128

Closed
page-down opened this issue Oct 17, 2021 · 2 comments
Closed

Issues related to fish shell when window focus is switched #4128

page-down opened this issue Oct 17, 2021 · 2 comments
Labels

Comments

@page-down
Copy link
Contributor

Describe the bug
Issue 1: fish shell text rendering issue.
With shell integration disabled:
When typing part of a command in the fish shell, opening a new window and switching back to the previous window, the cursor is positioned abnormally and the text remains after deleting all the text.

Issue 2: Mouse movement without click causes shell integration to be triggered.
With shell integration enabled:
Place the mouse cursor to the right of the command line prompt and click to activate the window and keep moving. Typing part of a command at the same time causes the unconfirmed part of the command to be completed. (Triggers the arrow right arrow key just like shell integration mouse clicks.)

To Reproduce
Issue 1: fish shell text rendering issue.

Steps to reproduce the behavior:

  1. Start kitty with shell integration disabled.
mv ~/.config/fish ~/.config/fish.bak
kitty --config=NONE -o shell_integration=disabled -o shell=fish
  1. Type 2 in first window. At this point fish prompts for the command 2to3, and the unconfirmed part is grayed out.
  2. Press ctrl+shift+enter to create new window. Then switch back to the first window.
  3. At this point the cursor is over the unconfirmed gray characters.
  4. Press Backspace to delete all the characters, however, 2 is still on the screen.

Screen recording:

issue1

Issue 2: Mouse movement without click causes shell integration to be triggered.

  1. Start kitty with shell integration enabled.
mv ~/.config/fish ~/.config/fish.bak
kitty --config=NONE -o shell_integration=enabled -o shell=fish
  1. Create a new window.
  2. Move the mouse continuously to the right of the command line prompt in the first window and click once to switch focus.
  3. When you enter part of the command, such as 2, you find that the command is automatically completed, even without clicking the mouse.

Screen recording:
issue2

Screenshots
See above.

Environment details

  • macOS
  • Fish Shell 3.3.1 without config
  • kitty from master branch

Additional context
These issues are related to the fish shell's command autoprompt, not sure if it's a problem with the fish shell itself.

@page-down page-down added the bug label Oct 17, 2021
@page-down
Copy link
Contributor Author

I think the second problem is caused by the click interval. Since the mouse click event is sent immediately to the program in the window, there will be: type command immediately after switching windows and the arrow keys are sent at the same time.

  • Sending mouse position clicks to the program immediately is a good way to go. In many cases users don't want to switch focus before they can click.
  • The click interval cannot be set too short, because there are still events such as double-clicks.

So is it possible to enter text immediately after switching focus (with mouse) without triggering shell integration mouse positioning?

@kovidgoyal
Copy link
Owner

  1. is caused by fish not redrawing the prompt on resize. This
    is taken care of by shell integration, which instructs fish to do so.
    There is an issue in the fish tracker about it if you care.

  2. If you want to send the click to the shell immediately you can set it
    up in kitty.conf. Use the press event instead of the click event, but
    note that doing so will break selections with the mouse. To really fix
    this you would need to have a key press during the click interval abort
    the click. But that would mean that if you click and start typing your
    click will not register, which is worse. I dont really see a good way to
    solve this. The only correct solution is for the shell to add support
    for a "move cursor here" escape code. The terminal can then send that
    escape code on a click rather than sending right arrow key presses.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants