Menu

#21 Tab cycling like in cmd.exe

open
nobody
None
5
2022-11-13
2011-09-14
Blackwell
No

This has been mentioned in the forum but I thought it should better be enlisted here explicitly.

I like the tab cycling of cmd.exe as it is much simpler for me than what other shells require me to do.

Example for other shells:

  1. Type something.
  2. Press Tab.
  3. If the remainder is unique the completion is done, goto 10.
  4. Look at the list of possible completions.
  5. Identify the next character I have to type in my desired completion.
  6. Find the key for that next character on the keyboard.
  7. Press Tab again.
  8. Check if completion is complete.
  9. If not complete, goto 2.
  10. Press Enter.

In cmd.exe:

  1. Type.
  2. Press Tab.
  3. Check if the completion is the desired one.
  4. If wrong completion, goto 3.
  5. Press Return.

Maybe these lists of steps make it clearer how and why cmd.exe Tab completion allows the user to be much less intellectually involved, they only need to bang on the Tab key repeatedly until they have the desired completion.

Discussion

  • Blackwell

    Blackwell - 2011-09-14

    I guess the steps for other shells are wrong. They should be:

    1. Type something.
    2. Press Tab.
    3. Check if completion is done; if so, goto 10.
    4. Look at the list of possible completions.
    5. Identify the next character I have to type in my desired completion.
    6. Find the key for that next character on the keyboard.
    7. Goto 2.
    8. Press Enter.
     
  • Blackwell

    Blackwell - 2011-09-14

    Still wrong, next correction:

    I guess the steps for other shells are wrong. They should be:

    1. Type something.
    2. Press Tab.
    3. Check if completion is done; if so, goto 8.
    4. Look at the list of possible completions.
    5. Identify the next character I have to type in my desired completion.
    6. Find the key for that next character on the keyboard.
    7. Goto 2.
    8. Press Enter.
     
  • Blackwell

    Blackwell - 2011-09-14

    By the way, something that is similar to cmd.exe Tab cycling exists in PyCmd already: Cycling through the directory history via Alt+Left/Right. The similarity might imply that arguments for/against one of these features apply to the other as well.

     
  • Horea Haitonic

    Horea Haitonic - 2011-09-14

    The cyclic behavior is nice when the list of completions is short (like the directory history), and cumbersome when it is long (like the list of files in most directories). Comparing these two use-cases is a bit of a stretch anyway, as they represent two different metaphors being useful in different situations/tasks. Think about explorer.exe: is has tree views, directory list views, location history etc. -- enforcing "similarity" across these would definitely hurt the user experience. In other words, using different metaphors for different tasks (writing commands vs. navigating the directory structure) is common, and most of the time desirable.

    This being said, I have nothing against having cyclical completion in PyCmd; there will be a configuration mechanism that will alow users to select one or the other, so there's nothing for anyone to lose.

     
  • Horea Haitonic

    Horea Haitonic - 2011-09-14

    Also, the way you describe the two approaches is biased: most people I know are more interested in efficiency, as in "write the desired command as quickly as possible", while you imply that the optimum is "use as little brain power as possible". I can't be the judge of which is best, and there's no need for me to be; as well as there's no need for you to try to convince anybody (yourself?) that your favorite model is better! Since there's no clear, universal "better", the next best thing is to support the most common "favorites".

    In short: I think you are wrong about your preferred model being better than the other(s?). You are right that PyCmd should support it, as it is the favorite model for some people.

    p.s. next time when you discuss this with someone, use the "cyclic completion keeps your screen clean of unsightly suggestions" argument -- it's much stronger than "there's no need to search for a key on the keyboard, just blindly press Tab until you get what you want". Keep in mind that most people that use a command-line shell are running away from the visual, low-brain-usage GUIs -- they are willing to trade some brain power for efficiency.

     
  • jdjdjd

    jdjdjd - 2012-03-01

    I am voting for this change (as an option/setting, of course). Better yet would be to provide both styles of completion, with the option then determining which style is mapped to Tab and which style is mapping to some other key.

     
  • Horea Haitonic

    Horea Haitonic - 2022-11-13

    Just wanted to mention (might be relevant to some users) that the completion has since been improved along the proposed direction -- but still not quite to what was originally requested: after pressing Tab and seeing a list of possible completions, one can press the Down arrow to start navigating through the list (using Up/Down, Left/Right, PgUp/PgDown, type-to-filter). While this is still not as easy as cycling completions with Tab, it does make the job simpler e.g. when the list is relatively short.

    The "cyclic" mode that was originally requested here is still not available, though -- I hope I can get to add that at some point.

     
    • Horea Haitonic

      Horea Haitonic - 2022-11-13

      A small note here: the updated "zsh-style" completion mechanism which supports navigating the list (which btw is now default unless overridden by behavior.completion_mode in init.py) shares one more advantage with the "cyclic" mode: less garbage is left over on the screen (the list of completions is erased when no longer needed)

       

Log in to post a comment.