my_tcl 7 % proc test args {puts "wwwww"}
my_tcl 8 % test [tab]wwwww
wwwww
[tab]
wwwww
wwwww
.gitignore README.md .vscode/ ...
my_tcl 8 % test
After two tabs the proc runs four times and then returns to the position before the tab. How should I avoid this problem?
It turns out that
tclreadline's built-in completion handler executes script-defined procs to search for sub- or ensemble commands. However, in presence of the catch-allargs, this will simply execute the proc during this "completion" attempt:Watch:
For now, avoid procs with only "args" in their formal parameter spec. You might want to file a ticket . The "args" case should be handled properly. (My gut feeling is that the completion service should only use "info" introspection for procs, without exploring for sub- or ensemble commands, with execution only necessary for commands like cget, configure etc.)