Skip to content

Commit 4e7ecde

Browse files
author
skywind3000
committed
update z_print to support fz.sh
update os.path.isdir to handle windows path better
1 parent e5c78e3 commit 4e7ecde

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

z.lua

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
-- z.lua - a cd command that learns, by skywind 2018, 2019
55
-- Licensed under MIT license.
66
--
7-
-- Version 1.5.3, Last Modified: 2019/02/17 16:22
7+
-- Version 1.5.4, Last Modified: 2019/02/19 11:18
88
--
99
-- * 10x faster than fasd and autojump, 3x faster than z.sh
1010
-- * available for posix shells: bash, zsh, sh, ash, dash, busybox
@@ -432,7 +432,7 @@ function os.path.isdir(pathname)
432432
end
433433
end
434434
local name = pathname
435-
if not name:endswith('/') then
435+
if (not name:endswith('/')) and (not name:endswith('\\')) then
436436
name = name .. '/'
437437
end
438438
return os.path.exists(name)
@@ -1275,13 +1275,14 @@ function z_match(patterns, method, subdir)
12751275
subdir = subdir ~= nil and subdir or false
12761276
local M = data_load(DATA_FILE)
12771277
M = data_select(M, patterns, false)
1278+
M = data_filter(M)
12781279
if Z_MATCHNAME then
12791280
local N = data_select(M, patterns, true)
1281+
N = data_filter(N)
12801282
if #N > 0 then
12811283
M = N
12821284
end
12831285
end
1284-
M = data_filter(M)
12851286
M = data_update_frecent(M)
12861287
if method == 'time' then
12871288
current = os.time()
@@ -1334,7 +1335,7 @@ end
13341335
-----------------------------------------------------------------------
13351336
function z_print(M, weight, number)
13361337
local N = {}
1337-
local maxsize = 10
1338+
local maxsize = 9
13381339
local numsize = string.len(tostring(#M))
13391340
for _, item in pairs(M) do
13401341
local record = {}

0 commit comments

Comments
 (0)