Compare commits

...

5 Commits

Author SHA1 Message Date
Eric Freese
94a24b0973
Merge 4ccfdb2435 into f8907cf32b 2024-11-16 00:59:33 +02:00
Eric Freese
f8907cf32b v0.7.1
Some checks failed
/ determine-versions (push) Failing after 16s
/ test (push) Has been skipped
2024-11-15 12:36:08 -07:00
Eric Freese
a50468ef4b Update changelog for v0.7.1 release 2024-11-15 12:35:58 -07:00
Eric Freese
9aceef9646 Remove circle ci reference left over from switch to github actions 2024-11-15 12:28:27 -07:00
Eric Freese
4ccfdb2435 Fix issue where partial accept duplicates last word
When z-sy-h is enabled after autosuggestion widgets have already been
bound, partial accepting the last part of a suggestion will result in
that string being duplicated.

I was able to reproduce using the following versions of the two plugins:
- z-sy-h: dde84e1b25f059a298ce3189cddfd0778f998df3
- z-asug: ae315ded4d

and running the following commands interactively one after another:

```
zsh -df
% source path/to/zsh-autosuggestions.zsh
% source path/to/zsh-syntax-highlighting.zsh
% bindkey -e
% bindkey <alt-f>         # shows 'bindkey -e-e'
```

The order of the `source` statements matters and the issue cannot be
reproduced if the two source statements are executed together on one
line.

The problem is very similar to this one:
  https://github.com/zsh-users/zsh-autosuggestions/issues/126#issuecomment-217121315

See GitHub issue #483
2020-01-29 21:47:57 -07:00
5 changed files with 19 additions and 7 deletions

View File

@ -1,5 +1,12 @@
# Changelog
## v0.7.1
- Clear POSTDISPLAY instead of unsetting (#634)
- Always reset async file descriptor after consuming it (#630)
- Always use builtin `exec` (#628)
- Add `history-beginning-search-*-end` widgets to clear widget list (#619)
- Switch CI from Circle CI to GitHub Actions
## v0.7.0
- Enable asynchronous mode by default (#498)
- No longer wrap user widgets starting with `autosuggest-` prefix (#496)

View File

@ -6,7 +6,6 @@ It suggests commands as you type based on history and completions.
Requirements: Zsh v4.3.11 or later
[![CircleCI](https://img.shields.io/circleci/build/github/zsh-users/zsh-autosuggestions.svg)](https://circleci.com/gh/zsh-users/zsh-autosuggestions)
[![Chat on Gitter](https://img.shields.io/gitter/room/zsh-users/zsh-autosuggestions.svg)](https://gitter.im/zsh-users/zsh-autosuggestions)
<a href="https://asciinema.org/a/37390" target="_blank"><img src="https://asciinema.org/a/37390.png" width="400" /></a>

View File

@ -1 +1 @@
v0.7.0
v0.7.1

View File

@ -162,11 +162,13 @@ _zsh_autosuggest_execute() {
_zsh_autosuggest_partial_accept() {
local -i retval cursor_loc
# Save the contents of the buffer so we can restore later if needed
# Save the original buffer/postdisplay so we can restore later if needed
local original_buffer="$BUFFER"
local original_postdisplay="$POSTDISPLAY"
# Temporarily accept the suggestion.
BUFFER="$BUFFER$POSTDISPLAY"
unset POSTDISPLAY
# Original widget moves the cursor
_zsh_autosuggest_invoke_original_widget $@
@ -186,8 +188,9 @@ _zsh_autosuggest_partial_accept() {
# Clip the buffer at the cursor
BUFFER="${BUFFER[1,$cursor_loc]}"
else
# Restore the original buffer
# Restore the original buffer/postdisplay
BUFFER="$original_buffer"
POSTDISPLAY="$original_postdisplay"
fi
return $retval

View File

@ -1,6 +1,6 @@
# Fish-like fast/unobtrusive autosuggestions for zsh.
# https://github.com/zsh-users/zsh-autosuggestions
# v0.7.0
# v0.7.1
# Copyright (c) 2013 Thiago de Arruda
# Copyright (c) 2016-2021 Eric Freese
#
@ -426,11 +426,13 @@ _zsh_autosuggest_execute() {
_zsh_autosuggest_partial_accept() {
local -i retval cursor_loc
# Save the contents of the buffer so we can restore later if needed
# Save the original buffer/postdisplay so we can restore later if needed
local original_buffer="$BUFFER"
local original_postdisplay="$POSTDISPLAY"
# Temporarily accept the suggestion.
BUFFER="$BUFFER$POSTDISPLAY"
unset POSTDISPLAY
# Original widget moves the cursor
_zsh_autosuggest_invoke_original_widget $@
@ -450,8 +452,9 @@ _zsh_autosuggest_partial_accept() {
# Clip the buffer at the cursor
BUFFER="${BUFFER[1,$cursor_loc]}"
else
# Restore the original buffer
# Restore the original buffer/postdisplay
BUFFER="$original_buffer"
POSTDISPLAY="$original_postdisplay"
fi
return $retval