@@ -83,6 +83,8 @@ char** cmd_argv;
8383static const char * log_filename = nullptr ;
8484static const char * metrics_filename = nullptr ;
8585static std::unique_ptr<std::set<std::string>> commands, sta_commands;
86+ static string last_command;
87+ static int last_level;
8688static bool no_settings = false ;
8789static bool minimize = false ;
8890
@@ -369,11 +371,10 @@ std::string findPathToTclreadlineInit(Tcl_Interp* interp)
369371} // namespace
370372#endif
371373
372-
373374static int TraceTclCommand (
374375 ClientData clientData,
375376 Tcl_Interp* interp,
376- int /* level */ ,
377+ int level,
377378 const char * command ,
378379 Tcl_Command commandToken,
379380 int /* objc */ ,
@@ -386,9 +387,11 @@ static int TraceTclCommand(
386387 Tcl_Obj *fullName = Tcl_NewObj ();
387388 Tcl_GetCommandFullName (interp, commandToken, fullName);
388389 string fullName_str = Tcl_GetString (fullName);
389- if (fullName_str.compare (0 , 7 , " ::sta::" )==0 ||!sta_commands->count (Tcl_GetString (objv[0 ]))){
390- logger->report (" [CMD] {}" , command);
391- }
390+ if (!(last_command==Tcl_GetString (objv[0 ])&&level==last_level+1 )){
391+ logger->report (" [CMD] {}" , command);
392+ last_command = Tcl_GetString (objv[0 ]);
393+ last_level = level;
394+ }
392395 }
393396 return TCL_OK;
394397}
@@ -466,6 +469,7 @@ static int tclAppInit(int& argc,
466469 }
467470 }
468471 }
472+ commands->insert (" set" );
469473 if (Tcl_Eval (interp, " info commands ::sta::*" ) == TCL_OK) {
470474 Tcl_Obj* cmd_names = Tcl_GetObjResult (interp);
471475 int cmd_size;
@@ -478,6 +482,9 @@ static int tclAppInit(int& argc,
478482 }
479483 }
480484 }
485+ last_command = " " ;
486+ last_level = 0 ;
487+
481488 Tcl_CreateObjTrace (
482489 interp,
483490 0 ,
0 commit comments