atuinsh / atuin

✨ Magical shell history
https://atuin.sh
MIT License
18.54k stars 520 forks source link

[Bug]: cmd+up-arrow disables up-arrow functionality for current prompt #2165

Closed injust closed 6 days ago

injust commented 1 week ago

What did you expect to happen?

The up-arrow binding should always work.

What happened?

I accidentally pressed cmd+up-arrow, which gave me the standard fish shell up-arrow behaviour.

I couldn't get back the atuin up-arrow behaviour until I hit enter (to get a new prompt) or ran a command (e.g. true).

Atuin doctor output

{
  "atuin": {
    "version": "18.3.0",
    "sync": null,
    "sqlite_version": "3.44.0"
  },
  "shell": {
    "name": "fish",
    "default": "fish",
    "plugins": [
      "atuin"
    ],
    "preexec": "built-in"
  },
  "system": {
    "os": "Darwin",
    "arch": "x86_64",
    "version": "14.5",
    "disks": [
      {
        "name": "Macintosh HD",
        "filesystem": "apfs"
      },
      {
        "name": "Macintosh HD",
        "filesystem": "apfs"
      }
    ]
  }
}

Code of Conduct

wugeer commented 1 week ago

Hello, I cannot reproduce this problem on my local machine. Can you provide a more detailed reproduction method?

image

screenshot.webm

injust commented 6 days ago

After further testing, I think this is a fish bug.

fish gets stuck in history search mode (commandline --search-mode is always true) after you press cmd+up-arrow, so _atuin_bind_up always calls up-or-search instead of _atuin_search --shell-up-key-binding.

I was only able to reproduce this in Ghostty. Couldn't reproduce in Terminal, kitty, or WezTerm. Might be because some terminals handle the cmd+up-arrow input themselves instead of sending it to the shell (e.g. Terminal uses it as a shortcut to jump to a mark).

injust commented 6 days ago

https://github.com/fish-shell/fish-shell/issues/10584