expand alias in cmdline with Ctrl-F in TCC

Jun 3, 2008
115
1
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
115
1
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
115
1
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
9,708
67
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
317
1
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
11,315
105
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
9,708
67
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
9,708
67
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
9,708
67
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