Ctrl-1 and the command history

Feb 23, 2012
240
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.
 
Feb 23, 2012
240
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?






I wonder whether HistCopy and/or HistMove would affect this behavior?
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,447
88
Albuquerque, NM
prospero.unm.edu
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).

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.
 
Feb 23, 2012
240
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!

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.
 
May 20, 2008
11,388
99
Syracuse, NY, USA
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?
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.
 
Similar threads
Thread starter Title Forum Replies Date
M Ctrl-C when using command line history does nothing Support 2
vefatica Ctrl-Enter in command history window? Support 8
Peter Murschall IDE: Ctrl-W is a Harakiri Command ! Support 23
R Emacs-style cmdline editing Ctrl-K Support 0
vefatica Can I alias @@Ctrl-Shift-Alt-u? Support 4
cgunhouse Ctrl-C from within a library function Support 6
Alpengreis Fixed [v26.00.26] Crash after answering INKEY with <Ctrl>+C Support 1
vefatica Ctrl-F? Support 3
MickeyF expand alias in cmdline with Ctrl-F in TCC Support 21
MickeyF Ctrl-S and Ctrl-Q in TCC Support 6
A How to? Copy+Paste in TCMD tabs with Ctrl-Shift-Ins? Support 5
samintz TCEDIT Ctrl-S Support 2
vefatica Ctrl-Alt-L (R, Left, Right). Support 8
V Ctrl-Home/End don't work in Win10 Support 3
Charles Dye Ctrl-Shift-Up doesn't update directory history Support 1
vefatica TPIPE.EXE crashes on Ctrl-C Support 9
Peter Murschall IDE destroys Text on Ctrl-U/Ctrl-Shift-U Support 12
vefatica TPIPE crashes on Ctrl-C Support 1
cgunhouse Ctrl + Shift keys and Paste (drop down menu and V) Support 4
M View doesn't recognize Ctrl+End and Ctrl+Pos1 Support 2
M Ctrl-End doesn't work. DelToEnd is not executed Support 13
C Output continues after Ctrl-Break Support 8
J How to? Debug Keyboard Shortcuts (Ctrl-A not remapping?) Support 8
Jay Sage Ctrl-C Not Working Reliably to Copy Screen Content Support 4
vefatica Ctrl-x? Support 13
C How to? ctrl-c does not prompt "Terminate batch job" Support 2
vefatica Ctrl-T and Ctrl-Shift-T Support 6
P Disable global hotkey Ctrl+Shift+T Support 19
vefatica DATEMONITOR + Ctrl-C crashes TCCv15 Support 5
dcantor Fixed Ctrl+Shift+Insert repeats last character Support 3
A WAD No newlines in copy with Ctrl-Ins Support 2
vefatica Ctrl-Up/Down? Support 21
E Ctrl-V does not always work in BDEBUGGER Support 4
vefatica Should Ctrl-C interrupt a COPY? Support 2
M Ctrl-C and Java Support 19
K Ctrl-D alias no longer works Support 4
vefatica Ctrl-F1? Support 0
J CTRL-C does not work on Windows 7 64-bit Support 3
dcantor Does variable expansion (ctrl-x) actually work? Support 27
E Ctrl+C not working as expected Support 8
Juanma Barranquero Ctrl-C trouble Support 1
Fross CTRL-C in V10 Support 3
S Ctrl-C handling while piping Support 0
vefatica .PL and Ctrl-C Support 3
vefatica LIST, Ctrl-C leaves visual artifact Support 0
D Can alias pass parameters to for command? Support 3
samintz How to? Search for %(command) in Help? Support 1
T VIEW only works from command line Support 14
rconn News Take Command / TCC / CMDebug / TCC-RT v28 Released Support 0
T Take Command 28: Lua reports version 5.4.0 (5.4.3 expected) Support 0

Similar threads