@@ -237,9 +237,8 @@ function shell.resolveProgram( _sCommand )
237237 end
238238
239239 -- If the path is a global path, use it directly
240- local sStartChar = string.sub ( _sCommand , 1 , 1 )
241- if sStartChar == " /" or sStartChar == " \\ " then
242- local sPath = fs .combine ( " " , _sCommand )
240+ if _sCommand :find (" /" ) or _sCommand :find (" \\ " ) then
241+ local sPath = shell .resolve ( _sCommand )
243242 if fs .exists ( sPath ) and not fs .isDir ( sPath ) then
244243 return sPath
245244 else
@@ -299,9 +298,9 @@ function shell.programs( _bIncludeHidden )
299298end
300299
301300local function completeProgram ( sLine )
302- if # sLine > 0 and string.sub ( sLine , 1 , 1 ) == " / " then
301+ if # sLine > 0 and ( sLine : find ( " / " ) or sLine : find ( " \\ " )) then
303302 -- Add programs from the root
304- return fs .complete ( sLine , " " , true , false )
303+ return fs .complete ( sLine , sDir , true , false )
305304
306305 else
307306 local tResults = {}
@@ -318,6 +317,16 @@ local function completeProgram( sLine )
318317 end
319318 end
320319
320+ -- Add all subdirectories. We don't include files as they will be added in the block below
321+ local tDirs = fs .complete ( sLine , sDir , false , false )
322+ for i = 1 , # tDirs do
323+ if not tSeen [ sResult ] then
324+ local sResult = tDirs [i ]
325+ table.insert (tResults , sResult )
326+ tSeen [ sResult ] = true
327+ end
328+ end
329+
321330 -- Add programs from the path
322331 local tPrograms = shell .programs ()
323332 for n = 1 ,# tPrograms do
0 commit comments