summaryrefslogtreecommitdiff
path: root/plugins/dirhistory
diff options
context:
space:
mode:
authorErin Schlarb <erin-dev@ninetailed.ninja>2023-04-20 13:30:49 +0200
committerGitHub <noreply@github.com>2023-04-20 13:30:49 +0200
commit18c837b136a9591117ef059eb8266c490d5eeee1 (patch)
tree7ea7c82dc7387eb84030818bc84cdd734bad10ea /plugins/dirhistory
parent9139d30ca30f8f687cc21121ed9b4f5238bc5260 (diff)
downloadzsh-18c837b136a9591117ef059eb8266c490d5eeee1.tar.gz
zsh-18c837b136a9591117ef059eb8266c490d5eeee1.tar.bz2
zsh-18c837b136a9591117ef059eb8266c490d5eeee1.zip
fix(dirhistory): run properly if `ksh_arrays` is set (#11630)
Diffstat (limited to 'plugins/dirhistory')
-rw-r--r--plugins/dirhistory/dirhistory.plugin.zsh8
1 files changed, 6 insertions, 2 deletions
diff --git a/plugins/dirhistory/dirhistory.plugin.zsh b/plugins/dirhistory/dirhistory.plugin.zsh
index 7021fc03a..8d67c6188 100644
--- a/plugins/dirhistory/dirhistory.plugin.zsh
+++ b/plugins/dirhistory/dirhistory.plugin.zsh
@@ -19,15 +19,17 @@ export DIRHISTORY_SIZE=30
# Returns the element if the array was not empty,
# otherwise returns empty string.
function pop_past() {
- typeset -g $1="${dirhistory_past[$#dirhistory_past]}"
+ setopt localoptions no_ksh_arrays
if [[ $#dirhistory_past -gt 0 ]]; then
+ typeset -g $1="${dirhistory_past[$#dirhistory_past]}"
dirhistory_past[$#dirhistory_past]=()
fi
}
function pop_future() {
- typeset -g $1="${dirhistory_future[$#dirhistory_future]}"
+ setopt localoptions no_ksh_arrays
if [[ $#dirhistory_future -gt 0 ]]; then
+ typeset -g $1="${dirhistory_future[$#dirhistory_future]}"
dirhistory_future[$#dirhistory_future]=()
fi
}
@@ -35,6 +37,7 @@ function pop_future() {
# Push a new element onto the end of dirhistory_past. If the size of the array
# is >= DIRHISTORY_SIZE, the array is shifted
function push_past() {
+ setopt localoptions no_ksh_arrays
if [[ $#dirhistory_past -ge $DIRHISTORY_SIZE ]]; then
shift dirhistory_past
fi
@@ -44,6 +47,7 @@ function push_past() {
}
function push_future() {
+ setopt localoptions no_ksh_arrays
if [[ $#dirhistory_future -ge $DIRHISTORY_SIZE ]]; then
shift dirhistory_future
fi