Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

ZSH USERS NOTE BACKWARD COMPATIBILITY WARNING!

Fix -t flag selecting the least, rather than most, recent matching
entry. Closes #68.
  • Loading branch information...
commit dfd4308ae84da481f774b3f5e732ee277d9d8769 1 parent b2d48e0
@rupa authored
Showing with 5 additions and 7 deletions.
  1. +5 −7 z.sh
View
12 z.sh
@@ -119,9 +119,7 @@ _z() {
}
function output(files, toopen, override) {
if( list ) {
- if( typ == "recent" ) {
- cmd = "sort -nr >&2"
- } else cmd = "sort -n >&2"
+ cmd = "sort -n >&2"
for( i in files ) if( files[i] ) printf "%-10s %s\n", files[i], i | cmd
if( override ) printf "%-10s %s\n", "common:", override > "/dev/stderr"
} else {
@@ -142,22 +140,22 @@ _z() {
for( i in matches ) if( matches[i] && i !~ clean_short ) return
return short
}
- BEGIN { split(q, a, " ") }
+ BEGIN { split(q, a, " "); oldf = noldf = -9999999999 }
@lysol
lysol added a note

Oh man what if your freceny is over 10 billion

@rupa Owner
rupa added a note

This doesn't affect frecency - only the -t flag, but I think this might break for directories you last accessed more than 316 years ago.

@lysol
lysol added a note

Oh man what if your -t flag is over 10 billion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
{
if( typ == "rank" ) {
f = $2
} else if( typ == "recent" ) {
- f = t-$3
+ f = $3-t
} else f = frecent($2, $3)
wcase[$1] = nocase[$1] = f
for( i in a ) {
if( $1 !~ a[i] ) delete wcase[$1]
if( tolower($1) !~ tolower(a[i]) ) delete nocase[$1]
}
- if( wcase[$1] > oldf ) {
+ if( wcase[$1] && wcase[$1] > oldf ) {
cx = $1
oldf = wcase[$1]
- } else if( nocase[$1] > noldf ) {
+ } else if( nocase[$1] && nocase[$1] > noldf ) {
ncx = $1
noldf = nocase[$1]
}
Please sign in to comment.
Something went wrong with that request. Please try again.