From 25ac9d7e4060e52b7b9f13a0532d583b8d4f5d3d Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Mon, 1 Jun 2026 11:22:20 +0200 Subject: [PATCH] add command "xschem selected_text" to get list of selected text object indexes --- doc/xschem_man/developer_info.html | 2 ++ src/scheduler.c | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/doc/xschem_man/developer_info.html b/doc/xschem_man/developer_info.html index 6c1c3c4c..fff9e54d 100644 --- a/doc/xschem_man/developer_info.html +++ b/doc/xschem_man/developer_info.html @@ -1500,6 +1500,8 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns" If what is not given or set to 'inst' return list of selected instance names If what set to 'rect' return list of selected rectangles with their coordinates If what set to 'text' return list of selected texts with their coordinates +
  • selected_text
  • +  Return list of selected texts 
  • selected_wire
  •    Return list of selected nets 
  • send_to_viewer
  • diff --git a/src/scheduler.c b/src/scheduler.c
    index ae5def55..4ddc0175 100644
    --- a/src/scheduler.c
    +++ b/src/scheduler.c
    @@ -5417,6 +5417,22 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
             }
           }
         }
    +    /* selected_text
    +     *  Return list of selected texts */
    +    else if(!strcmp(argv[1], "selected_text"))
    +    {
    +      int n, i, first = 1;
    +      if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;}
    +      rebuild_selected_array();
    +      for(n=0; n < xctx->lastsel; ++n) {
    +        if(xctx->sel_array[n].type == xTEXT) {
    +          i = xctx->sel_array[n].n;
    +          if(first == 0)  Tcl_AppendResult(interp, " ", NULL);
    +          Tcl_AppendResult(interp, my_itoa(i), NULL);
    +          first = 0;
    +        }
    +      }
    +    }
     
         /* selected_wire
          *  Return list of selected nets */