WAD Problem With F1 Help

Jun 2, 2008
284
1
Newton, MA
#1
In most cases, when I enter a command and press F1, the help opens to that command. However, when I do this with the command line "cd", the display turns into the following

TCC(19.00.25): C:\>cdExtensions to built-in CD: /H (TCC home), /P (profile), /K (desktop)​

The F1 key is invoking the quick help instead of the full help (and without the newline).
 
#2
That's coming from my 4UTILS plugin and it should be followed by the built-in quick help for CD. I know of no way around it other than to rename the plugin function. What newline are you talking about?
 
#3
Actually, when I type "CD" and press F1, I see
Code:
4UTILS Extensions to built-in CD:

  /H (TCC home), /P (profile), /K (desktop)

Display or change the current directory.

CD [/D /N /R /X] [path | - | :folder]
  path:  The directory to change to
  -:  Change to previous directory
  /D(rive) - change drive too  /R(eparse point)
  /N(o fuzzy search)  X exclude\
 
Jun 2, 2008
284
1
Newton, MA
#4
What I mean is that if I enter the command "cd /?", I get the quick help on the line under the command line, not concatenated to the command, as I do when I press F1.

Did this happen under version 17? Perhaps I never tried using F1 with a command that was superseded by a plugin command. (In fact, I have CD aliased to a batch file.)

What is the F1 key supposed to do? Even though "WHICH DIR" shows that DIR is an alias on my computer, pressing the F1 key brings up the TCC help for the DIR command. Does a plugin command with the same name as a TCC command always cause the F1 key to behave differently, or are you intercepting F1?

Is there a way for me to turn off the CD command in 4UTILS?
 
Jun 2, 2008
284
1
Newton, MA
#6
Plugin issue, not TCC.
So Vince pointed out. Most of my questions were for him, but, Rex, you might be able to answer the part about how the F1 key works. Is Vince including code to intercept it in his plugin, or do plugins always intercept it when the command is a plugin command?

If the former, Vince needs to change the code to include CRLF so that the help text appears in the line below the command and not concatenated with it.
 
#8
This is what I see when I enter "cd<f1>".
Code:
v:\> cd
4UTILS Extensions to built-in CD:

  /H (TCC home), /P (profile), /K (desktop)

Display or change the current directory.

CD [/D /N /R /X] [path | - | :folder]
  path:  The directory to change to
  -:  Change to previous directory
  /D(rive) - change drive too  /R(eparse point)
  /N(o fuzzy search)  X exclude\
Frankly, I can't see why I'm getting the newline. And I can't see why, with or without the newline, why you're not seeing "4UTILS "; that's part of the help string. The help itself doesn't contain a leading newline, so I'd expect it to start printing at the current insertion point. I'll keep looking.
 
#9
What I mean is that if I enter the command "cd /?", I get the quick help on the line under the command line, not concatenated to the command, as I do when I press F1.
It should be two lines below the command line, one newline because of the execution of "CD /?" and another provided by (my) CD'd handling of "/?". When you "CD<F1>" you should still get the second one mentioned.
Code:
v:\> cd /?

4UTILS Extensions to built-in CD:

  /H (TCC home), /P (profile), /K (desktop)

Display or change the current directory.

CD [/D /N /R /X] [path | - | :folder]
  path:  The directory to change to
  -:  Change to previous directory
  /D(rive) - change drive too  /R(eparse point)
  /N(o fuzzy search)  X exclude\
Here's the definition of the help string.
Code:
  {L"CD",       CD,         L"4UTILS Extensions to built-in CD:\r\n\r\n\t/H (TCC home), /P (profile), /K (desktop)"},
Here's how my CD handles "/?".
Code:
    switch ( p[1] )
     {
       case L'?' : Printf(L"\r\n%s\r\n\r\n", item[icd].Help);
             return 0xFEDCBA98; // this gives both helps
And here's what happens when TCC calls my HELP function (as with "F1").
Code:
  else if ( (i = GetItemIndexFromName(psz)) >= 0 )
   {
     if ( item[i].Help != NULL )
     {
       if ( i != icd )
         Printf(L"%s\r\n", item[i].Help);
       else
       {
         WCHAR szCmd[32] = L"CD /?";
         Command(szCmd, 0);
       }
     }
In any event, "CD /?" gets called, and it provides a leading newline. Any ideas, Rex?
 
#10
So Vince pointed out. Most of my questions were for him, but, Rex, you might be able to answer the part about how the F1 key works. Is Vince including code to intercept it in his plugin, or do plugins always intercept it when the command is a plugin command?
F1 causes TCC to call my plugin's HELP command. It should provide a leading newline as mentioned in my recent post.
"CD /?<Enter>" (which itself provides a newline) calls my CD which, with "/?" provides another newline. I don't know (yet) why you're seeing something different.

I use the CD extensions all the time (and rarely the builtin ... I prefer auto dir changes). If I can't figure out what's happening, I'll get rid of CD and add CDH (TCC's home), CDP (profile) and CDK (desktop). They're shorter and I would get used to them pretty quickly.
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
3,613
46
Albuquerque, NM
prospero.unm.edu
#11
I suspect the easiest fix would be to display your help text with MessageBox() instead of Printf(). (Note that the F1 key handler and your /? option handler can call different code, even if both routines display the same text.)
 
#12
I suspect the easiest fix would be to display your help text with MessageBox() instead of Printf(). (Note that the F1 key handler and your /? option handler can call different code, even if both routines display the same text.)
All my plugins suffer from the fact that F1 help appears below the current command line, and the current command line is left intact. I'll try MessageBox() (when "/?" is not specified) and see if I like it. Can I leave a MessageBox showing while the user continues the command line?
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
3,613
46
Albuquerque, NM
prospero.unm.edu
#13
All my plugins suffer from the fact that F1 help appears below the current command line, and the current command line is left intact. I'll try MessageBox() (when "/?" is not specified) and see if I like it. Can I leave a MessageBox showing while the user continues the command line?
MessageBox() is modal. (Personally I don't see that as a problem; you've got Usage() for on-screen hints while typing the command line.)
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
3,613
46
Albuquerque, NM
prospero.unm.edu
#14
I'm trying version 2014.1117 Build 202222, and the F1 behavior is -- a little surprising, but not bad at all. I'm not expecting help text to pop up on the line I'm editing, but it doesn't hurt anything.

But I do notice that CD's help is always just one line. F1, /?, HELP, always one line; I'm not seeing the multiline help in your quote. We must be using different builds.
 
#15
I'm trying version 2014.1117 Build 202222, and the F1 behavior is -- a little surprising, but not bad at all. I'm not expecting help text to pop up on the line I'm editing, but it doesn't hurt anything.

But I do notice that CD's help is always just one line. F1, /?, HELP, always one line; I'm not seeing the multiline help in your quote. We must be using different builds.
I must have changed it since then because that one misbehaves similarly for me. I put a couple of current DLLs in ftp://lucky.syr.edu/4plugins/special/ if you (Jay, Charles) want to try them. There might be other new stuff in 4UTILS; I haven't kept track well.

Charles .. you think the F1 behavior is OK? I don't use it for plugin stuff precisely because I'm annoyed by the help appearing after a command line in progress. Something GUI that could remain visible while the user continued a command line might be better. Eh?
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
3,613
46
Albuquerque, NM
prospero.unm.edu
#16
Charles .. you think the F1 behavior is OK? I don't use it for plugin stuff precisely because I'm annoyed by the help appearing after a command line in progress. Something GUI that could remain visible while the user continued a command line might be better. Eh?
Depending on how fancy you want to get, of course. But maybe expanding the help text would be more useful?
 
#17
I haven't followed all the discussion above, but here is what I see on my screen, both in TCMD (as shown here) and in a detached TCC session.:

upload_2015-12-17_13-53-1.png

No newlines are being displayed, not one and not two.

Here is what happens in TCMD with "CD /?":

upload_2015-12-17_13-55-11.png

I get only one newline. Though I do seem to get an extra one after the help display.
 
#19
I just loaded the "special" version, and here is what I see.

upload_2015-12-17_23-27-51.png

At the end, the cursor was sitting right after the CD command. If I press ESC to exit the command or let the command run, its output appears in the midst of the help text and makes a mess.

upload_2015-12-17_23-30-40.png

I had to use CLS to get rid the of help text before I could continue working.
 
#20
All my plugins print the F1 help below the command_line_in_progress, making it messy to continue. I really didn't have the F1 help in mind when I designed them, and if the F1 help in going to appear in the console, there's no alternative. I experimented with message boxes. I can get the F1 help in a message box that stays on top (of everything) while still allowing you to continue working in the console (but it's also on top if you switch to another app). What do you think of that modus operandi? I can always get rid of CD completely and add CDH, CDP, and CDK (they're actually easier to type); but they'll suffer from the same F1 behavior

What happened in your second screen shot? Did you do "CD /H<F1>" and then execute the command? As it is, that's what's going to happen.
 
#21
What happened in your second screen shot? Did you do "CD /H<F1>" and then execute the command? As it is, that's what's going to happen.
Yes. I think you should just leave things as they are. This is not a big deal. If you could easily clear the help text as soon as something else happened, that would be fine. Also, if you had a full help file like TCC's that would pop up in another window, that would be fine, too, but I'm not sure it's worth the trouble. This whole discussion started when pressing F1 after entering CD did not bring up TCC's help for CD, as I had expected.