Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Problem with tab completion

Jan
25
0
I'm trying to write a tab completion script (in BTM) and am having problems. I was trying in v28 which didn't work, so I have just upgraded to v31 to see if that fixed the problem, but nothing has changed.

If my script just returns a single filename, that works. If it returns a couple of filenames, then I get a popup window to select from, but my 'real' script returns 83 filenames, and, in that case, the popup window just displays the first entry and hangs, so I have to kill the instance of TCC

I've also tried having it cycle through filenames (so it just needs to return a single filename) like the default tab functionality does, but the tab completion script doesn't get called again after it's completed the filename the first time (unless I edit the completed result first)

Is the 'hanging' a known problem? If so, is there any workaround?

Is it meant to call the tab completion script over and over if you just keep pressing tab? If so, what could I be doing wrong?
 
I almost have no idea when I'm doing. This script (extremely barebones) correctly opens a pop-up window with all the matching names.

Code:
set search=%@quote[%@unquote[%2]*]
set tabcompletionresult=%@findfirst[%search]
do while 1 == 1
    set x=%@findnext[%search]
    if "%x" == "" leave
    set tabcompletionresult=%tabcompletionresult %x
enddo
echo %@findclose[%search] > NUL
quit 0

Here it is in action. I typed echo w3<tab> ...

1704228825309.png


I cursored down to the third file name and pressed enter. The command line was completed.

1704228939221.png
 
@pscs Is your script doing something different than what pressing the F7 key does? I can't imagine needing anything special if your tab completion is based on filenames alone. If you need to search metadata and only display files containing certain data that's a different story.
 
@pscs Is your script doing something different than what pressing the F7 key does? I can't imagine needing anything special if your tab completion is based on filenames alone. If you need to search metadata and only display files containing certain data that's a different story.
It's getting a list of filenames with a certain filename prefix (it's getting files that match 'csrfile_*')

However, your question made me try something, and it appears that it's actually the 'F7' functionality that's broken for me. Pressing F7 on my PC either beeps (if there are no files), gives me the only filename (if there's one file) or displays a window with the first filename and then hangs.

So, the question now is why would the F7 window hang for me?

It happens with v28 and v31. I've got rid of my TCSTART scripts, tab completion scripts, etc and v31 is otherwise at defaults, so I'm not sure what it could be.

Just going to try a reboot
 
F7 (PopFile?) doesn't work in any TCC back to v24 but it's very likely I got rid of it. "PopFile=Ctrl-Tab" is in all my TCMD.INIs and it works in all versions except v31.
 
My TCMD.INI has;
Code:
PopFile=F7 Ctrl-Tab

...which allows me to have two keys defined to do the same thing,
that is,
F7 or Ctrl-Tab.

Joe
 
My TCMD.INI has;
Code:
PopFile=F7 Ctrl-Tab

...which allows me to have two keys defined to do the same thing,
that is,
F7 or Ctrl-Tab.

Joe
Does either work in v31? When I add F7, F7 works and Ctrl-Tab still doesn't.
 
Off topic, but it seems that the OPTION command cannot set keys (I thought it could).

Thus, to read the value of PopFile;
Code:
echo %@iniread[%_ininame,Keys,PopFile]
F7 Ctrl-Tab

To write a value to PopFile;
Code:
chronic echo %@iniwrite[%_ininame,Keys,PopFile,F7]

or

Code:
chronic echo %@iniwrite[%_ininame,Keys,PopFile,F7 Ctrl-Tab]

You could also;
Code:
tcedit /ini

to open the tcmd.ini file, search for PopFile, and make changes.

Joe
 
Last edited:
Aha again. Ctrl-Tab is for tab switching in both TCMD and WindowsTerminal.
 
Ok, now I'm confused :-)

My tcmd.ini has
PopFile=F7 Ctrl-Tab
If I change it to just Ctrl-Tab, in stand-alone TCC, it does exactly the same as F7, and just hangs. I've tried it in v25, v28 and v31 (the only versions I have installed at the moment) and they're all the same

(Ctrl-Tab in TCMD does tab switching)

From what you're all saying, it sounds as if it's just specific to my PC that F7 hangs when displaying the window.

This is on x64 Windows 11
 
I'm using Windows 11, and F7 works as expected for me.

To troubleshoot, I would suggest 1) starting TCC in safe mode with tcc.exe /i ; and 2) trying tabcomplete /u * .
 
As stated in Post #11, I'm using stand-alone TCC.

What is the console type of the TCC having problems?

Is it using Legacy Console?
1704402375467.png


What is the Default Terminal Application?
1704402340770.png


Not sure if this is the issue, just looking for clues...

Joe
 
I'm using Windows 11, and F7 works as expected for me.

To troubleshoot, I would suggest 1) starting TCC in safe mode with tcc.exe /i ; and 2) trying tabcomplete /u * .
In Safe mode (run CMD.EXE, cd \program files\jpsoft\tcmd31, tcc /i) exactly the same happens on pressing F7
(Tried with /d as well, no change)

Ran tabcomplete /u *
When I pressed F7, it still hung

What is the console type of the TCC having problems?
Command Prompt (cmd.exe) is set not to use Legacy Console, and the 'Default Terminal Application' is blank, with no options available

1704448913804.png


In Settings -> System -> For Developers, there's a 'Terminal' option there, I've tried both 'Windows Console Host' and 'Windows Terminal' (and Let Windows Decide). TCC looks different in the different modes, so I guess the change is being applied, but F7 hangs in both options.

1704449511333.png
 

Attachments

  • 1704448898857.png
    1704448898857.png
    77 KB · Views: 8
  • 1704449488354.png
    1704449488354.png
    224 KB · Views: 9

Similar threads

Back
Top