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

Ctrl-1 and the command history

Discussion in 'Support' started by Avi Shmidman, Apr 7, 2012.

  1. Avi Shmidman

    Joined:
    Feb 23, 2012
    Messages:
    238
    Likes Received:
    3
    One of TCC's very useful features is the ability to press Ctrl-1, Ctrl-2, etc., on the command line, to duplicate arguments from the previous command.
    One unexpected problem I've run into, however, is that when a command is executed from the command history, the subsequent command cannot draw upon its arguments with Ctrl-1 etc.
    To illustrate, let's say I do the following:
    1] I run "cd \windows"
    2] I run "cd \temp"
    3] Now, I hit the up-arrow twice to get the command "cd \windows" to reappear, and I hit enter
    4] Now I type "dir" and hit Ctrl-1
    I would expect that this would print "\windows" on the command line, from my previous command in step 3. However, instead, it prints "\temp".
    Presumably, this is because the command in step 3 was executed from the command history without any modification. However, I believe that in the overwhelming majority of situations this will not be the desired behavior. When referring to arguments of the previous command, it seems to me that it shouldn't matter whether the previous command was a new command or a repeat of a previous command; either way, the user may well want to do more things with the same arguments.
     
  2. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,311
    Likes Received:
    39
    I wonder whether HistCopy and/or HistMove would affect this behavior?
     
  3. Avi Shmidman

    Joined:
    Feb 23, 2012
    Messages:
    238
    Likes Received:
    3
    Hi Charles,
    I'm not sure what you are referring to (a search for "histcopy" in the help file does not turn up any results).
    Nevertheless, your post caused me to consider other ways in which this issue might be connected with the command history, and it led me to find another oddity, as follows. If global history is enabled, then Ctrl-1 will take the parameter from a different tab, if a more recent command was executed there. For instance, let's take the following sequence:
    1] I run: "cd \windows" in tab 1
    2] I run: "cd \temp" in tab 2
    3] Now I switch back to tab 1, type "dir", and hit ctrl-1
    At this point, TCC will fill in "\temp", not "\windows", even though the most recent command displayed in this tab is "cd \windows".

    It seems to me that this is not the desired behavior. To be sure, a global command history is useful for many purposes. However, when a user hits Ctrl-1, the user is presumably looking physically at the displayed command line, and decides to repeat something from the previous line displayed. That is, with Ctrl-1, the user presumably wants to duplicate something that he or she *sees*. Therefore, it seems to me that Ctrl-1 should repeat the parameter from the previous command in the current tab, even if there are more recent commands from other tabs in the global command history.
    Do other TCC users agree?






     
  4. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,311
    Likes Received:
    39
    Type OPTION, select the Command Line tab, and see whether you have either "Copy to end" or "Move to end" turned on. If neither one is on, try turning "Copy to end" on and see whether that make it behave the way you expect.
     
  5. Avi Shmidman

    Joined:
    Feb 23, 2012
    Messages:
    238
    Likes Received:
    3
    Yes, that does indeed provide the results I originally expected - that is, after enabling "copy to end", when a line is repeated from the command history, Ctrl-1 does in fact refer back to that line.
    Thanks for the tip!

     
  6. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,969
    Likes Received:
    30
    I do not agree. I use a global history and I want it to be just that, a global history.

    You might want to use a local history when in a TCMD tab. Are you using SHRALIAS? I don't understand why one woulkd use a global history list without SHRALIAS.

    Perhaps it's not made clear, but the Ctrl-1 (et c.) mechanism retrieves arguments from the last command in the history list (which is not necessarily the last command you executed). "Copy/Move to end" puts a recalled command at the end of the list.
     

Share This Page