summaryrefslogtreecommitdiff
path: root/plugins/dirhistory/dirhistory.plugin.zsh
diff options
context:
space:
mode:
authorTuowen Zhao <ztuowen@gmail.com>2023-11-04 18:38:46 -0700
committerTuowen Zhao <ztuowen@gmail.com>2023-11-04 18:38:46 -0700
commit4d908094fdc2a0c0e9a0a072eba213fab7adef43 (patch)
tree7c17e70bcdeebbe96c84d849bdf17882007480d8 /plugins/dirhistory/dirhistory.plugin.zsh
parent4b0bbc0b263a150eb9a9b59f196914629be06a9b (diff)
parent632ed413a9ce62747ded83d7736491b081be4b49 (diff)
downloadzsh-master.tar.gz
zsh-master.tar.bz2
zsh-master.zip
Merge remote-tracking branch 'github/master'HEADmaster
Diffstat (limited to 'plugins/dirhistory/dirhistory.plugin.zsh')
-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