Skip to content
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

[Bug] unexpected behavior when ABBR_EXPANSION_CURSOR_MARKER set to caret #140

Open
2 tasks done
olets opened this issue Jun 16, 2024 · 2 comments
Open
2 tasks done
Labels
bug Something isn't working priority: low

Comments

@olets
Copy link
Owner

olets commented Jun 16, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Update the issue title

  • I have updated the title

Expected Behavior

Can use an arbitrary string as the ABBR_EXPANSION_CURSOR_MARKER.

Actual Behavior

If ABBR_EXPANSION_CURSOR_MARKER is ^, \^, '^', expansions without the cursor marker are doubled, with the cursor between them.

Steps To Reproduce

% ABBR_EXPANSION_CURSOR_MARKER='^'
% abbr a=b
% a[SPACE] # expands to `b[CURSOR]b`

Environment

zsh-abbr version 5.8.0
zsh 5.9 (arm-apple-darwin21.3.0)
OSTYPE darwin21.3.0

Installation method

Plugin manager

Installation method details

zcomet

Anything else?

@olets olets added needs triage bug Something isn't working priority: low and removed needs triage labels Jun 16, 2024
@olets olets changed the title [Bug report] unexpected behavior when ABBR_EXPANSION_CURSOR_MARKER set to caret [Bug] unexpected behavior when ABBR_EXPANSION_CURSOR_MARKER set to caret Jun 16, 2024
@qadzek
Copy link

qadzek commented Jun 21, 2024

Instead of fixing this bug and supporting a caret as ABBR_LINE_CURSOR_MARKER (I have no idea how complicated that would be), maybe the documentation could just suggest a couple of characters that are known to work without issues?

I did change the default ABBR_LINE_CURSOR_MARKER from % to ^ because % would break abbreviations like abbr -g cdate="\$(date +'%F')". I have now changed it to @, and that seems to behave as expected.

By the way, after reading the documentation again, I learned about "context-dependent abbreviations" and "building command templates", which are both very cool features!

@olets
Copy link
Owner Author

olets commented Jun 25, 2024

maybe the documentation could just suggest a couple of characters that are known to work without issues

Good idea. Rather than doing that exactly, I've added callouts for a few limitations

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

No branches or pull requests

2 participants