Skip to content

Commit

Permalink
Fix bug in completion
Browse files Browse the repository at this point in the history
Fixes issue #9.
  • Loading branch information
marlonrichert committed Jan 15, 2021
1 parent 7f73565 commit 90bd125
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions _hist
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,23 @@ _arguments -s -A '' ${(i)options} ":action:(( ${(j: :)${(i)actions[@]}} ))" \
local -a keys=() events=() displays=() matches=()
local -i end=15
case $words[CURRENT] in
'')
| - )
words[CURRENT]=-1
;&
-<1->)
-<1-> )
local -i start=$(( HISTNO + words[CURRENT] ))
keys=( {$start..$(( start - end ))} )
print -v events -f "%$#HISTNO.${#HISTNO}s %s" "${(kv@)history[(I)(${(~j:|:)keys})]}"
local -a offsets=( {$words[CURRENT]..$(( words[CURRENT] - end ))} )
local -i len=$(( $#HISTNO + 1 ))
print -v displays -f "%$len.${len}s %s" "${(@)offsets:^events}"
;;
<1->)
<1-> )
keys=( {$words[CURRENT]..$(( words[CURRENT] + end ))} )
print -v events -f "%$#HISTNO.${#HISTNO}s %s" "${(kv@)history[(I)(${(~j:|:)keys})]}"
displays=( "${(Oa@)events[@]}" )
;;
*)
* )
return
;;
esac
Expand Down

0 comments on commit 90bd125

Please sign in to comment.