ZTree.com  | ZEN  | About...  

 Index   Back

[Discuss] Navigating directly to a specific file   [Discuss]

By: John Gruener     Orlando, Florida  
Date: Mar 11,2018 at 16:08
In Response to: [Discuss] Navigating directly to a specific file (Slobodan Vujnovic)

> I can't remember, and could not
> find it in help: is navigating
> directly to a specific file possible with ZTree?


> Does anybody have a need for this - jumping to a file from command
> line and/or from within ZTree? Instantly, zero navigation.

I'd find it very useful and would certainly use it. Others seem to agree.

> What could be done in both cases is to analyze the full spec and
> then - and only then - jump to that file, if it exists!

Great suggestion!

We would of course want this to work even if no files are yet logged, and it would be best to not disturb the logged state if the file does not exist. So ZTree would need to use an OS function to first determine whether the file exists, which is I think what you are suggesting. This would seem simple enough since even an IF EXISTS command would do it. If it doesn't exist, display an error. If it does, log the entire path to it, open the File Window and highlight it.

There are several ZTree commands which could be modified or enhanced to do this. As suggested, one would be to use the current Treespec command. Perhaps with a function-key option which would clear the input line into which would be typed or pasted the full path to the file. But I don't really like that because it's no longer a "Treespec". Another would be, as Bill suggested, use Alt-Open in the Tree Window. But that suggests "opening" the file instead of simply logging and highlighting it, which is the objective.

Also, both those options would be available only in the Tree Window. I think it would be better to have this work from any Window.

Far better in my opinion would be to create a new command, perhaps using the single/double-quote key, which would immediately prompt for input. Advantages of a new command would be a single keystroke without further complicating commands like Treespec, while also allowing it in the File Window. It could then also have its own History list. How sweet would that be to have a History list of frequently-opened files? To me that would be the greatest benefit of this.

If the file is not found, a beep error should occur, requiring another [Enter] or [Esc]. I think this would be safe even if executed in a File Window.

If the current Filter would prevent displaying the file, the best option would be for ZTree to compare the file name (everything after the last backslash) with the current Filter spec. If the file exists but it doesn't match, display a prompt asking whether to reset the Filter. If the response is Yes, reset the Filter and navigate to the file, else cancel the command.

I also think the entire path to the file must be specified, including the drive letter. Attempting to make it work relative to the current drive or directory would just complicate this more than necessary, and produce inconsistent results from the History list. I do however think that environment variables should be supported, provided of course that they result in the entire path being specified.

- John

Thread locked

Messages in this Thread

95,011 Postings in 11,977 Threads, 349 registered users, 32 users online (0 registered, 32 guests)
Index | Admin contact |   Forum Time: Jul 2, 2020 - 1:06 am EDT  |  Hits:31,874,559  (968 Today )
RSS Feed