Skip to content

Bash vi history search redraws the prompt incorrectly after the prompt length increases. #2252

Closed as not planned

Description

@ocmstone

Is this a reproducible bug?

  • I confirm this is a reproducible bug, not a feature request, idea, question, contribution proposal, or direction check.
  • I reproduced this bug on the version and environment reported below using the exact steps provided.

Current behavior

With set -o vi enabled, after changing into a directory that makes PS1 longer (/w), pressing Esc then / to perform a history search redraws the prompt incorrectly. The prompt is truncated, and the search text begins at the wrong position. Pressing Ctrl-L immediately redraws the prompt correctly.

Expected behavior

The full current prompt is displayed and the search text appears immediately after it.

Reproduction

Start Herdr while in $HOME.

Run:

bash --noprofile --norc
set -o vi
PS1='\u@\h:\w$ '
cd into a directory with a much longer path.
Press Esc, then /.
Begin typing a history search.

Impact

The prompt is corrupted and matches render illegibly at the right side of the screen.

Environment

  • Herdr version: 0.7.5
  • Update channel (stable or preview): stable
  • Operating system: macOS Tahoe 26.6
  • Terminal: Terminal.app (Apple)
  • Shell, if relevant: bash 5.3.15
  • Relevant config, if any: set -o vi

Activity

  1. ogulcancelik commented on Aug 3, 2026

    @ogulcancelik
    Collaborator

    I couldn't reproduce this on an Apple Silicon Mac using the official Herdr 0.7.5 binary, Bash 5.3.15, and Terminal.app. I tested at both 80 and 120 columns with the exact steps above; the full prompt and /cd remained correctly positioned. Herdr 0.8.0 behaved correctly too.

    The only environment mismatch was macOS 26.5.2 versus 26.6. Could you share your Terminal window dimensions and a short screen recording of the corruption?

  2. ocmstone commented on Aug 5, 2026

    @ocmstone
    Author

    Thanks for looking into this! Adding examples in herdr and in terminal.app showing the problem occurs in herder only.

    herdr:
    https://github.com/user-attachments/assets/033778e9-dcb1-42b9-9261-9f237c7a4eae

    Terminal.app:
    https://github.com/user-attachments/assets/92d22900-dd7c-41de-9d84-825c099c563e

  3. ogulcancelik commented on Aug 5, 2026

    @ogulcancelik
    Collaborator

    Thanks, the Herdr recording clearly shows the redraw. I noticed it uses your configured prompt with $(pathN 2), rather than the minimal prompt in the report, and the Herdr and Terminal.app windows have different dimensions.

    Could you confirm whether it reproduces with the exact minimal setup below?

    bash --noprofile --norc
    set -o vi
    PS1='\u@\h:\w\$ '
    printf 'TERM=%s\n' "$TERM"
    stty size

    Please include the TERM and stty size output from both Herdr and Terminal.app at matching dimensions. If it only occurs with your configured prompt, please also share:

    declare -p PS1
    declare -f pathN
  4. ocmstone commented on Aug 5, 2026

    @ocmstone
    Author
  5. ogulcancelik commented on Oct 1, 2026

    @ogulcancelik
    Collaborator

    hey, we're cleaning up issues from before 0.9. a lot changed since then and some of these may already be fixed or behave differently now, so i'm closing older reports that haven't had activity since 0.9.0 shipped.

    if this still happens for you on the latest version, please open a new issue with the template so we can triage it against the current version. thanks for reporting it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    maintainer-neededrequires maintainer judgment or maintainer-only reproduction

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions