1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Tab completion annoyances

Discussion in 'Support' started by thorsten, Mar 10, 2013.

  1. thorsten

    Joined:
    Aug 16, 2008
    Messages:
    120
    Likes Received:
    0
    1.
    Code:
    > pin<TAB>
    > C:\Windows\system32\PING.EXE 
    Tab completion should complete to "ping" (or ping.exe) but not include the whole path

    2. Tab completion doesn't cycle: at the end of the list tab just stops. You can go back through the list with Shift+Tab but Tab should start at the beginning again (that's how it's done in other shells)

    3. Tab completing paths with spaces is broken:
    Code:
    > "C:\Program Files<TAB>
    > "C:\Program Files
    Obviously TCC tries to complete "Files". But even plain Cmd is able to "see" that the command line starts with a '"':
    Code:
    > "C:\Program Files<TAB><TAB>
    > "C:\Program Files (x86)"
     
  2. Stefano Piccardi

    Joined:
    May 31, 2008
    Messages:
    376
    Likes Received:
    2
    Re "Program Files", try this
    C:\Progr<TAB>
    you get
    "C:\Program Files"\
    the dangling \ only if you have the corresponding option set with OPTION
    then type
    *<TAB>
    you get "C:\Program Files\SomeDir"\
    and continue from there

    This is the way TCC tab completion has worked (for me) for many years.
    I agree that linux shells do it another way, which needs less typing.
    Perhaps you could file a feature suggestion, an OPTION to change tab completion style to "linux mode". I would vote for it.
     
  3. Stefano Piccardi

    Joined:
    May 31, 2008
    Messages:
    376
    Likes Received:
    2
    I disagree. If multiple ping.exe files are on my system, how would I know which one is going to be executed?
     
  4. thorsten

    Joined:
    Aug 16, 2008
    Messages:
    120
    Likes Received:
    0
    Sorry, but you didn't understand what I wrote. TCC doesn't complete quoted paths with spaces when the cursor is "behind" the first space. That's just stupid and broken. Even Cmd.exe does it. So it has (of course) absolutely nothing to do wiith Linux shells.
     
  5. thorsten

    Joined:
    Aug 16, 2008
    Messages:
    120
    Likes Received:
    0
    You don't. If you type "ping" you don't know which one is executed. If you type ping it means that you don't care which one is executed (otherwise you would've specified the complete path. Completiion is there to complete - not to add things you never specified.
     
  6. Stefano Piccardi

    Joined:
    May 31, 2008
    Messages:
    376
    Likes Received:
    2
    If I type sort<TAB> on my system I get the full path of one of the sort.exe programs I use. If I type <TAB> again I get the full path to another sort.exe I use. I find that behaviour clear, consistent and useful. If it worked the way you suggest, what would I see?
     
  7. thorsten

    Joined:
    Aug 16, 2008
    Messages:
    120
    Likes Received:
    0
    For "sort" you would just get a beep because it's already fully completed. Unless you had another program called "sorter" in which case the second tab would complete to that.
     
  8. Stefano Piccardi

    Joined:
    May 31, 2008
    Messages:
    376
    Likes Received:
    2
    And how would I know which of the two sort.exe in my system is going to be executed?
     
  9. thorsten

    Joined:
    Aug 16, 2008
    Messages:
    120
    Likes Received:
    0
    As I already said: you don't. If you type a command without specifying the path you don't and you don't want to.
     
  10. Stefano Piccardi

    Joined:
    May 31, 2008
    Messages:
    376
    Likes Received:
    2
    I begin to see the subtle nuance of my thinking; I use command TAB completion also to locate commands, not just to complete the command line. Well, I find that useful.
     
  11. thorsten

    Joined:
    Aug 16, 2008
    Messages:
    120
    Likes Received:
    0
    When you have two commands with the same name and want to quickly execute one that is not in "pole position" in the path and you don't want to specify the complete path, yes, then it's useful. But in the majority of cases where you just want to complete a command to save typing, it's just annoying.
     
  12. Stefano Piccardi

    Joined:
    May 31, 2008
    Messages:
    376
    Likes Received:
    2
    Yes, it can be annoying. To save myself from typing I rely more on aliases, and use TAB more to find commands and files. The downside to using aliases is that I need to define each alias and remember it! If TCMD had alias TAB completion my downside would be solved, but I don't know about your annoyance.
     
  13. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,729
    Likes Received:
    80
    I think the (vast) majority of TCC users would disagree with you on this one When I originally added path completion, it worked the way you want, and I received a deluge of complaints about it not including the path. After I added the path, nobody has said a word about it for years until your post.

    You can add it to the feedback forum; if enough other users vote for it I'll add it as an option (but definitely not the default).

    WAD, and also as requested by other users. (You're the first one that's asked for it to loop.) I think this would be especially annoying for path completions with a large number of paths in the directory, as it wouldn't be obvious until you cycled through an extra time or two that you were getting repeats.

    Again, add it to the feedback forum to see if anybody else wants the same thing.
     
  14. thorsten

    Joined:
    Aug 16, 2008
    Messages:
    120
    Likes Received:
    0
    In that case you should also fix path completion because there's going be a deluge complaining about not including the path:

    [C:\Windows] cd system3<TAB>
    [C:\Windows] cd C:\Windows\System32

    That's because of TC's really lacking completion system. In other shells you will get a list of possible completions so you can see "where" you are. Zsh allows you to actually select from the menu you see. Even Cmd has now optional menu completion in conjunction with Clink.

    Did I mention that path completion is broken? You cannot complete paths with spaces in it when the cursor is behind the blank. Oh, and path completion does not include directories from CDPATH. I would call that broken, too.

    And of course alias completion...
     
  15. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,277
    Likes Received:
    38
    Sort of like what happens when you press F7 in TCC?
     
  16. Avi Shmidman

    Joined:
    Feb 23, 2012
    Messages:
    238
    Likes Received:
    3
    I agree with Rex about this; I very much appreciate seeing the entire path of the tab-completed command.

    However, as I've recently pointed out on the uservoice forum, a slight problem remains. Normally, after executing a command, one can type the first part of the command and then hit up-arrow to see the previous use of that command. (E.g. after executing "ping 8.8.8.8", one can later type "ping", hit up-arrow, and the command "ping 8.8.8.8" will appear.) The problem is that this doesn't work if the command was auto-completed with path. That is, if one auto-completes ping and then executes "c:\windows\ping.exe 8.8.8.8", one cannot later type "ping" and hit up-arrow to see the command, because the command now starts with "c:\windows", rather than ping.

    Therefore, I've added a suggestion on the uservoice forum for the excellent up-arrow feature to match the beginning of the names of the files executed in the cases where the filenames were preceded by full paths. (That is, after executing c:\windows\ping, the string "ping" should be able to invoke the command by itself, without path).

    For any of you who agree that this would be a helpful addition to TCC, please vote for the feature request here:

    http://jpsoft.uservoice.com/forums/...-history-match-on-command-line-for-filename-w
     
  17. thorsten

    Joined:
    Aug 16, 2008
    Messages:
    120
    Likes Received:
    0
    Now, that is nice (and of course, what I meant)!

    It would be very useful to

    a) have that automatically come up when you hit the Tab key /and/ the number of possible completions exceeds a certain number (I think it's ten by default in Z shell) and

    b) only when you run TCC locally as it makes TCC completely hang when connected via SSH.

    I could figure out the latter ("iff not defined ssh_connection then") but for the former I could use some help.
     
  18. thorsten

    Joined:
    Aug 16, 2008
    Messages:
    120
    Likes Received:
    0
    I don't get it. If you type "ping whatever" you don't see the whole path. Actually that's the whole point of typing ping (and having a path variable) that you don't need to know and don't have to care where exactly your command is. If you complete internal commands you don't see a path. Why would anyone prefer a monster like "C:\Windows\system32\ping.exe" to a simple "ping"?!
     
  19. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,277
    Likes Received:
    38
    Edit your .INI file (e.g. NOTEPAD "%_ININAME" ) and add a line
    Code:
    PopFile=Tab
    
    to the section after the label [4NT]. Restart TCC.

    (The 'magic number' is one. If there is only one possible completion, it will be added to the command line automatically. If there's more than one, you'll get the popup window.)
     
  20. thorsten

    Joined:
    Aug 16, 2008
    Messages:
    120
    Likes Received:
    0
    Charles, would that be equivalent to "option //PopFile = Tab"? I need to put that in tcstart.btm enabled only for local session because popup's naturally don't work via ssh.
     
  21. thorsten

    Joined:
    Aug 16, 2008
    Messages:
    120
    Likes Received:
    0
    Forget my stupid question, I just tried it an it works with //option
     
  22. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,277
    Likes Received:
    38
    I was all set to type "Hell no, you can't remap keys with OPTION" or words to that effect. But I tried it first, and to my amazement it worked.

    I would've sworn OPTION doesn't support key mapping directives!
     
  23. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,784
    Likes Received:
    29
    I have three versions of SORT.EXE (Windows, Gnu, ThompsonToolKit), quite different from each other and all in my path. If I used path completion, I'd want (need) to know which I was getting.
     
  24. thorsten

    Joined:
    Aug 16, 2008
    Messages:
    120
    Likes Received:
    0
    You'll get the same one you get when you type "sort" and don't tab complete.
     
  25. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,729
    Likes Received:
    80
    But that is why everybody else wants the path to be included -- it's a feature, not a bug. People want to know what they're executing; if you don't care, there's no reason to use command completion.

    You want to remove functionality that other users rely on, for the sake of a personal aesthetic preference (and apparently a desire to be surprised by what the command processor decides to execute). That will never be the default behavior -- but if you get enough users to vote on your preference, I will consider adding it as an option.
     
    Avi Shmidman likes this.
  26. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,729
    Likes Received:
    80
    Paths do not get added if the match is in the current directory.

    That has been in TCC / 4NT / 4DOS for more than 20 years.

    TCC always quotes names with embedded whitespace. The only way you can get into the condition you're reporting is if you deliberately add the opening quote and deliberately not add the closing quote. Supporting that is highly problematic (I've tried) because of the difficulty in preparsing the command line to determine what is an appropriate matching quote. (Multiple quotes, back quotes, escape characters, command groups, and variables with embedded quotes make it virtually impossible.)

    CDPATH and fuzzy directory searches are mutually exclusive. CDPATH is very, very obsolete early 4DOS syntax that was replaced many years ago with fuzzy directory searches. It's only been retained because a handful of users were using it in production batch files. (But it's probably time to retire it forever.)

    Alias completion was tried a while back, but was scrapped when it turned out to be relatively useless. Unless you're creating long alias names (and nobody does) there's not much to complete.
     
  27. thorsten

    Joined:
    Aug 16, 2008
    Messages:
    120
    Likes Received:
    0
    Sorry, but this is getting ridiculous

    a) the only reason to use command completion (actually any kind of completion) is not "wanting to know what you're executing" but simply having to type less and thus saving time.

    b) " People want to know what they're executing". So you never type Win+R notepad ENTER?

    People do _not_ want to know what they're executing.
    People type "ping" all the time instead of ping.exe - which means that ping.bat, ping.com, ping.cmd, ping.vbs; ping.vbe, ping.js, ping.jse, ping.wsf, ping.wsh, or ping.msc could be executed. No one cares.

    People type "ping" all the time without specifying the whole C:\Windows\System32 path in front or using tab completion. Take Command users are no exception to that.

    c) it's not the command processor who decides what to execute, it's the PATH variable that determines what to execute. The path variable is under the control of the user. Why don't you complete directories like you do with commands? A simple "cd temp" could land you anywhere (depending on your CDPATH).

    Again: why don't you complete...
    C:\Windows> cd tem<TAB>
    C:\Windows> cd C:\Windows\temp

    d) this is not a matter of "personal aesthetic preference". If a user types a command without a path, it means he doesn't want to be bothered with specifying a path. You are forcing some kind of artificial decision onto him. If I type notep<TAB> - how should I know which notepad I want? The one in C:\Windows or the one in C:\Windows\System32 (it's actually one and the same file - just hardlinked)?

    And of course: this is how /all/ other shells that do command completion (PowerShell, bash, Z shell) work.

    e) If a user really wants to know which command gets executed and if there are multiple commands with the same name, this is what the which command is for.
     
  28. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,729
    Likes Received:
    80


    That is apparently your usage. It is not mine (or apparently most other users).



    Nope. Notepad is an awful POS; I've replaced it with Notepad++ for simple edits. But that doesn't have anything to do with command completion. If you know you've only got one app on your entire system with a given name (unlikely, but it's possible for a small system), why do you need command completion in the first place? To save a character or two? You're better off defining an alias; it'll be a lot faster and you won't get an unpleasant surprise when the inevitable second app of the same name appears on your system.

    That is not correct. The PATH variable is one thing (but not the most important) that the command processor uses to determine what to execute, along with aliases, file associations, executable extensions, searching for executables in the current directory, searching the Windows and System32 directories (regardless of whether they're in the PATH, and in different order depending on the Windows version), PATHEXT, and the content of the "App Paths" registry key. And in all cases, it's ONLY the command processor who decides what to execute.



    As I already said, filename matches in the current directory do not get the path prepended.

    When you want to change established (10+ year) behavior, you have to have a really compelling reason and unconditional support from the other users. You've made your preferences clear, and added them to the feedback forum. If other users feel the same way, they'll support you there. In the meantime, I am not going to change the existing behavior (which is what other users have previously asked for).
     
  29. thorsten

    Joined:
    Aug 16, 2008
    Messages:
    120
    Likes Received:
    0
    It has nothing to do with "deliberately not add the closing quote". You can get in this situation all the time:
    Code:
    > cd C:\pro<TAB>
    > cd "C:\Program Files"\vm<TAB>
    Oh, VMware is not in "Program Files" is has to be in "Program Files (x86)", right? Let's go back to "C:\Program Files" and continue tab completing
    ^W<BACKSPACE><BACKSPACE>
    Code:
    > cd "C:\Program Files<TAB>
    Oops, why is nothing happening?
    Well, it does work in Cmd.exe.

    CDPATH is pretty much alive in Bash and Z Shell. People use it in interactive shells. I never used extended directory searches for the simple reason that I would have had to update the database manually all the time. Well, I guess I should rethink that now that you've added Everything as the search engine.

    The same goes probably for internal name completion. Unless you're creating long internal names like "everything" (and nobody does that) there's not much to complete.
     
  30. thedave

    Joined:
    Nov 13, 2008
    Messages:
    254
    Likes Received:
    2
    You misspelled "the only reason YOU use command completion"... That's not the only reason I use command completion.

    Although I suppose you're partially right, I DO use it do save a lot of typing. "ping<tab>" is less typing than "C:\Windows\system32\PING.EXE" or C:\Win<tab>\syst<tab><tab>\pin<tab>"

    Because it's not necessary, the ambiguity has been resolved. Most of us are smart enough to figure out that "temp\" is relative to the current local path, since it's not absolute. However, since it exists in the current directory, there's no ambiguity about what will be done, so the full path isn't needed in this case.

    What's the problem with displaying the entire path then, other than personal aesthetic preference?

    Or, put another way, if you close your eyes, TCC does exactly what you want, it's only the way it's displayed that isn't what you want, which is the definition of an aesthetic preference. If you don't care about the full path, don't pay attention to it, but don't try and take away useful functionality from the rest of us.

    So use all of the other shells, if you're happier with their behaviour? I find the bash implementation of auto-complete to be obnoxious, and it's one of the things I really hate about working with my Linux boxes, but such is life.

    Tab is quicker and easier, and still saves a lot of typing since the correct result may not be the first hit. Which won't help me find the right notepad.exe, it'll just show the first, whereas I can quickly tab through the options if more than one comes up.[/quote]
     

Share This Page