Skip to content

[Bug]: Atuin TUI causes prompt misalignment and corrupted command output on Zsh (macOS, Alacritty/Terminal) #2728

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

Open
1 task done
jordanpmc opened this issue Apr 30, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@jordanpmc
Copy link

What did you expect to happen?

After triggering Atuin via the up-arrow key in Zsh, I expected the terminal to:

  • Restore the prompt correctly (with proper spacing and cursor alignment)

  • Display any injected command output with correct line breaks and formatting

  • Leave the terminal in a usable, sane state without requiring reset or restart

What happened?

When Atuin's interactive TUI is triggered via the up-arrow key and then exited (by selecting a command or pressing escape):

  • The shell prompt becomes misaligned, with the $ symbol indented or offset.
  • The output of the restored command is broken, with incorrect line breaks or spacing.
  • This corruption persists until the terminal is reset or restarted.

The issue occurs even in a clean Zsh environment (zsh -f) with no plugins or theme, and is reproducible in both Alacritty and macOS Terminal.

The root cause seems to be Atuin leaving the terminal in an inconsistent TTY state after exiting its TUI interface—likely failing to reset stty flags or restore from raw mode.

Image Image

Temporary Workaround
Adding the following functions to .zshrc (after eval "$(atuin init zsh)") resolves the issue by manually resetting the terminal before and after each command:

eval "$(atuin init zsh)"

_atuin_fix_echo() {
    stty echo
    stty sane
}

precmd_functions+=(_atuin_fix_echo)
preexec_functions+=(_atuin_fix_echo)

This restores prompt and output correctness, but is not ideal.

Atuin doctor output

{
  "atuin": {
    "version": "18.5.0",
    "sync": null,
    "sqlite_version": "3.46.0"
  },
  "shell": {
    "name": "zsh",
    "default": "zsh",
    "plugins": [
      "atuin"
    ],
    "preexec": "built-in"
  },
  "system": {
    "os": "Darwin",
    "arch": "arm64",
    "version": "15.4.1",
    "disks": [
      {
        "name": "Macintosh HD",
        "filesystem": "apfs"
      },
      {
        "name": "Macintosh HD",
        "filesystem": "apfs"
      }
    ]
  }
}

Code of Conduct

  • I agree to follow this project's Code of Conduct
@jordanpmc jordanpmc added the bug Something isn't working label Apr 30, 2025
@DrorDvash
Copy link

yep, same here...here is my issue from Dec 2024 #2514

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants