expand alias in cmdline with Ctrl-F in TCC

Jun 3, 2008
127
3
Temecula, CA
From the TCC help:

You can expand an alias on the command line and view or edit the results by pressing Ctrl-F after typing the alias name, but before the command is executed.

When I hit Ctrl-F, it pops up a windows Find dialog. Running TCC 16.03.55 64-bit on Windows 10 Pro.

->ver
TCC 16.03.55 x64 Windows 8.1 [Version 6.3.17134]
 
I don't have Version 16 installed, but with Version 25, it is Ctrl-W. This is what the help file says;

Expanding Aliases at the Prompt

You can expand an alias on the command line and view or edit the results by pressing Ctrl-W after typing the alias name, but before the command is executed. This replaces the alias with its contents, and substitutes values for each alias parameter, just as if you had pressed the Enter key. However, the command is not executed; it is simply redisplayed on the command line for additional editing.

Ctrl-W is especially useful when you are developing and debugging a complex alias, or if you want to make sure that an alias that you may have forgotten won't change the effect of your command.

Joe
_x64: 1
_admin: 1
_elevated: 1

TCC 25.00.17 x64 Windows 10 [Version 10.0.18362.295]
OS Name: Microsoft Windows 10 Pro
OS Version: 10.0.18362 N/A Build 18362
 
Jun 3, 2008
127
3
Temecula, CA
From the help file, under "What's New In Version 21";

Thanks. So apparently this is another thing I've lost since the move to Windows 10. Sigh.

Yeah, I could always upgrade to the latest version. That takes money (not much, but honestly, it's an annoyance and not a need, which means I can't justify it to management).
 
Jun 3, 2008
127
3
Temecula, CA
It's a Windows 10 dialog. You can disable that by going to your console properties and selecting legacy console.

Thanks, Rex. This one worked. (If only my Ctrl-S / Ctrl-Q still worked, but even setting legacy didn't solve that. Good ol' Microsoft. But that's another thread...)
 
May 20, 2008
11,400
99
Syracuse, NY, USA
I would't put it past them... Heh But I updated mine yesterday (every 2nd Tuesday of the month is "patch Tuesday").
Any ideas? Ctrl-F works in CMD (find dialog). In Powershell it produces "^F". In TCC it does nothing.

It was assigned to ListFindReverse (don't think I did that). I removed that assignment ... still nothing. TCC sees the keystroke (odd if the console is supposed to process it) and can even use it (e.g., for AliasExpand). Does TCC turn off the console's Ctrl key shortcuts? What other ones are there? I'd like to see if any work.
 
Jun 2, 2008
359
4
Unfortunately I can't speak for v25 as I have TCC LE v14.00.9. How 'bout completely bare bones with nothing tweaked/loaded? The IT guy in me wonders about a reboot, but v24 working and v25 not makes me think it probably won't help.

Edit: Ninjad by Rex! :)
 

rconn

Administrator
Staff member
May 14, 2008
12,344
149
Could that be made optional?

Sure - if you want the Windows / CMD editing keys, set ReadConsole=YES in your TCMD.INI, and you'll get all of the Windows command line editing "wonderfulness" (and none of the TCC editing keys). You can't mix and match some of this & some of that.

Prior to v25, I was getting dozens of "bug" reports with TCC & Win 10 because Windows is eating the TCC editing keys. The alternatives are either to ALWAYS turn on legacy mode in TCC (which introduces new incompatibilities), or turn off the new Windows control keys. The latter is less harmful, and has triggered exactly one complaint -- you want (for unknown reasons) to display the Windows console search dialog with the default Ctrl-F. (Note that TCMD has a far more capable console search dialog.)
 
May 20, 2008
11,400
99
Syracuse, NY, USA
I might be able to live with that since I'm not very savvy when it comes to the keyboard. About all I use are Right, Left, Home, End, Backspace, insert from clipboard, and F1.

(Off topic) This has renewed interest because Windows 10 has broken my plugin CSBFIND. A keyhandler maps it to Alt-F; it does a regex search, centers the found text vertically and reverses its colors, and restores the colors when it moves on to the next match. With the Windows 10 enhanced console, reversing the colors makes them BLA ON BLA and restoring them leaves them BLA ON BLA ... not very useful. Here (below) is the code I use to reverse the colors. Do you know how to patch it up? When I was in the Insider Program I complained about two methods of reading character attributes leading to different results, even sent a test app to demonstrate it. That code is now on my dead laptop and I don't remember the details. I think you and I may have discussed this also.

Code:
VOID ReverseColors(HANDLE hConOut, COORD cdCursorPos, DWORD dwLen)
{
    DWORD dwUtil;
    LPWORD wAttribs = (LPWORD) AllocMem( dwLen * sizeof(WORD) ); 
    ReadConsoleOutputAttribute(hConOut, wAttribs, dwLen, cdCursorPos, &dwUtil);
    for ( DWORD i=0; i<dwLen; i++ )
        wAttribs[i] = ( ( wAttribs[i] & 0x000F ) << 4 ) + ( ( wAttribs[i] & 0x00F0 ) >> 4 );
    WriteConsoleOutputAttribute(hConOut, wAttribs, dwLen, cdCursorPos, &dwUtil);
    FreeMem(wAttribs);
}
 
May 20, 2008
11,400
99
Syracuse, NY, USA
It didn't take long to figure out that ReadConsole=Yes is unacceptable. It breaks F1-help and the history keys. I didn't look any further.
 
May 20, 2008
11,400
99
Syracuse, NY, USA
Now I remember (having reproduced it). Whereas ReadConsoleOutput() gets the attributes correct, ReadConsoleOutputAttribute() always gives 0. This may be evidenced by the following.

1568342648237.png
 
Similar threads
Thread starter Title Forum Replies Date
Joe Caverly Expand all aliases on the command line Support 2
jbanaszczyk DOC: @expand Support 0
I "IF" command in a variable does not expand redirection variable name Support 0
williamleara WAD ribbon doesn't remember expand/collapse setting Support 3
C %systemroot% doesn't expand Support 11
D Can alias pass parameters to for command? Support 3
Jay Sage Issue with CD_ENTER Alias Support 37
Jay Sage Issue with CD_LEAVE Alias Support 3
Jay Sage WAD Failure of Alias Command with /Z Option Support 14
R @select inside alias gives different (insanely small) window Support 7
kb6ojs ALIAS with multiple commands? Support 9
vefatica Can I alias @@Ctrl-Shift-Alt-u? Support 4
D Alias with setdos no longer works Support 21
vefatica TPIPE in an alias? Support 2
Peter Murschall TCC V26.01.3x Debugging has problems with Alias /R Support 1
Peter Murschall CMDebug 26.01.37 has problems with Alias Support 21
samintz How to? Alias or prompt? Support 1
Jay Sage Directory Alias Access to FTP Servers Support 2
rps How to? Shralias and producing history.sav, alias.sav .. Support 6
J Alias @@F5 hotkey Support 2
vefatica alias.sav not accurate Support 8
Joe Caverly Using a Directory Alias with @iniwrite fails Support 14
N multiple command alias and redirection Support 0
vefatica SETLOCAL ... ALIAS ... pipes Support 2
B TCC 21.01.50 Problem with ALIAS /r and SET /r Support 2
rps How to? Alias/Command line use of *log on/off Support 2
MickeyF alias terminating before it should Support 3
JohnQSmith ALIAS /R in TCSTART.BTM Support 9
D Alias in batch file Support 3
vefatica Can't execute @ALIAS[...] Support 5
E How to? Load Alias File on Startup Support 3
I Windows 10 console does not allow alt-F4 alias to complete Support 1
MickeyF create an alias with optional parameter Support 4
nickles Alias expansion Support 7
T scrput `` in alias or function Support 2
vefatica Alias works differenltly v16 vs. v17 Support 13
B Alias with multi line definitions not assigned Support 6
jbanaszczyk Alias with space in the name Support 3
jbanaszczyk Alias for internal command Support 8
D Clear alias parameters Support 7
T Fixed multi-line alias issue Support 13
keithg1964 WAD 16.0027 Alias /rz bug Support 8
R In addition to ALIAS /Z and FUNCTION /Z, HISTORY /Z? Support 1
tmaynard How to? Control-U alias for Escape (command line editing) Support 5
C Alias ListEmptyFldrs=??? Support 4
M How to? Put logic into an alias... Support 6
G How to? v15: Can't alias Alt-Z Support 7
nikbackm v15: Problem with ALIAS in command group Support 10
vefatica WAD DO i=1 TO %# in an alias? Support 9
cgunhouse Directory Alias Issue Support 7

Similar threads