Skip to content

[Bug]: Inappropriate preview line row with strategy static #2987

@sky96111

Description

@sky96111

What did you expect to happen?

[preview]
## which preview strategy to use to calculate the preview height (respects max_preview_height).
## possible values: auto, static
## auto: length of the selected command.
## static: length of the longest command stored in the history.
## fixed: use max_preview_height as fixed height.
strategy = "static"

When preview strategy is set to static, it calculate length of the longest command stored in the history.
In its design, it is intended to display all commands as comprehensively as possible.

But not all longest command cost the most line rows, because command with line break \^J can take up more lines than command with most characters.

Proper display should be like:

 │ 1 5s     1d ago cd ~/Desktop; sudo littlesnitch capture-traffic -p '/Library/Input Methods/SogouInput.app/Contents/│
 │ > 28m    1d ago scrcpy \^J--no-mouse-hover \^J--video-codec=h265 \^J--keyboard=uhid                                │
 │────────────────────────────────────────────────────────────────────────────────────────────────────────────────────│
 │[    GLOBAL    ]                                                                                                    │
 │────────────────────────────────────────────────────────────────────────────────────────────────────────────────────│
 │scrcpy \                                                                                                            │
 │--no-mouse-hover \                                                                                                  │
 │--video-codec=h265 \                                                                                                │
 │--keyboard=uhid                                                                                                     │
 ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

What happened?

Preview area presents only 2 lines (the longest command costs), which result in command with break line character be cut.

 │ 1 5s     1d ago cd ~/Desktop; sudo littlesnitch capture-traffic -p '/Library/Input Methods/SogouInput.app/Contents/│
 │ > 28m    1d ago scrcpy \^J--no-mouse-hover \^J--video-codec=h265 \^J--keyboard=uhid                                │
 │────────────────────────────────────────────────────────────────────────────────────────────────────────────────────│
 │[    GLOBAL    ]                                                                                                    │
 │────────────────────────────────────────────────────────────────────────────────────────────────────────────────────│
 │scrcpy \                                                                                                            │
 │--no-mouse-hover \                                                                                                  │
 ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

Atuin doctor output

❯ atuin doctor
Atuin Doctor
Checking for diagnostics


Please include the output below with any bug reports or issues

{
  "atuin": {
    "version": "18.10.0",
    "commit": "",
    "sync": null,
    "sqlite_version": "3.46.0"
  },
  "shell": {
    "name": "zsh",
    "default": "zsh",
    "plugins": [
      "atuin"
    ],
    "preexec": "built-in"
  },
  "system": {
    "os": "Darwin",
    "arch": "arm64",
    "version": "26.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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions