--▽▽UTF-8▽▽ -- SciteFileBrwoser.lua -- 15.06.2012 -- apasejkin at interzet dot ru scite_Command { --'ASCIITable|ASCIITable|Alt+a', --'ascii_table|ascii_table|Alt+b', 'FileBrowser|createContent|Ctrl+F4', 'Make tag|createCtag|Alt+T', } local cmd, dir, pat, up, sep, begPos, endPos if props['PLAT_WIN'] == '1' then --cmd = 'dir /b /o /a:-h ' cmd1 = 'dir /b /o /a:d ' cmd2 = 'dir /b /o /a:-d ' sep = '\\' pat = '\\[^\\]+$' elseif props['PLAT_GTK'] == '1' then cmd = 'ls -1v' sep = '/' pat = '/[^/]+$' end up = '[..]' scite_OnKey(function(keyval, shift,ctl,atl) if output.Focus then if not shift and not ctl and not atl then --print("---"..keyval) begPos=-1 endPos=-1 end end end) local function updateContent() if begPos and endPos then output:remove(begPos, endPos) end begPos = output.Length local content = scite_Popen(cmd1..'"'..dir..sep..'"') local files = {} for line in content:lines() do table.insert(files,'+'..line) end content:close() content = scite_Popen(cmd2..'"'..dir..sep..'"') for line in content:lines() do table.insert(files,line) end content:close() print(dir..sep) print(up) for i,file in pairs(files) do print(file) end --[[ --print(cmd..'"'..dir..sep..'"') print(dir..sep) print(up) print(content:read '*a') content:close() ]]-- endPos = output.CurrentPos --print('bbbbb--'..begPos) --print('eeeee--'..endPos) end function createCtag() local ext = scite_GetProp('FileExt','lua') local makectag if ext == 'lua' then makectag=lua_Path()..'/ctags.exe -R --languages=lua' elseif ext == 'c' or ext == 'cpp' or ext == 'cxx' then makectag=lua_Path()..'/ctags.exe -R --languages=c++ --langmap=c++:+.c' else end local ext = scite_GetProp('FileExt','lua') scite_Popen(device_of(dir)..' && cd '..dir..' && '..makectag) end function createContent() dir = props['FileDir'] updateContent() end local oldOnDoubleClick = OnDoubleClick or function()end function OnDoubleClick() local name, path name = output:GetCurLine():sub(1, -2) --print(name) if not dir or not output.Focus or name == '' or name == dir..sep or endPos <= output.CurrentPos or output.CurrentPos <= begPos then oldOnDoubleClick() return end --print('bbbbb::'..begPos) --print('eeeee::'..endPos) if name == up then path = dir:gsub(pat, '') else local ch=string.sub(name,1,1) if ch == "+" then name=string.sub(name,2) end --print(ch) --print(name) path = dir..sep..name end local file = io.open(path) if io.type(file) then file:close() scite.Open(path) else dir = path updateContent() end end