Skip to content

Renaming variable changes all instances except on readarray #1317

Open
@LeonardoMor

Description

@LeonardoMor

Code editor

Neovim

Platform

macOS Sequoia 15.5

Version

5.6.0

What steps will reproduce the bug?

Take this function:

tmpl::add() {
    [[ $1 && $2 ]] || {
        die e "add: source or targets is an empty string"
        help >&2
        exit 1
    }
    local tmplstr targets=()
    $EDITOR "$PREFIX/$1"
    readarray -td: targets <<<"$2"
    tmplstr="{{ template \"${PREFIX#*.chezmoitemplates/}/$1\" . }}"
    for f in "${targets[@]}"; do
        echo "$tmplstr" >"$f"
    done
}

How often does it reproduce? Is there a required condition?

Always.

What is the expected behavior?

All instances all the variable should be renamed.

What do you see instead?

With the cursor over any instance of targets except for the one on readarray, if you rename it, all instances are renamed correctly, except for the one on readarray.

If the cursor is over the targets on readarray and you try to rename it, you'd be told that there's nothing to rename.

Additional information

This might be somewhat similar to #1183

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions