Tcl Source Code

View Ticket
Login
Ticket UUID: ac104c9ecbb4066f9694fdba421d46dce67bb7c2
Title: lsearch -index help page
Type: Bug Created on: 2024-03-20 08:16:03
Submitter: anonymous Assigned to: nobody
Subsystem: 17. Commands I-L Severity: Minor
Priority: 5 Medium Last modified: 2024-11-12 23:19:07
Status: Closed Closed by: jan.nijtmans
Resolution: Fixed Closed on: 2024-11-12 23:19:07
Version: 8.6+
Description:
I think the example given here (https://www.tcl.tk/man/tcl8.6/TclCmd/lsearch.htm#M26) is not the right one, because with or without the '-index' option, the result is the same. 

lsearch -index 1 -all -inline {{a abc} {b bcd} {c cde}} *bc*
> {a abc} {b bcd}
lsearch -all -inline {{a abc} {b bcd} {c cde}} *bc*
> {a abc} {b bcd}

Tested with versions: 8.6.14 and 9.0b1
User Comments:
pooryorick added on 2024-11-08 11:19:13:

Fixed in [17a6f70fc1]. Someone might want to backport the fix as well.


juliannoble2 added on 2024-11-12 07:04:37:
I think the original example for the -stride version was wrong too.
The result is just a list - and shouldn't show as braced, as none of the earlier lsearch examples have an extra level of bracing for a list result.

  lsearch -stride 2 -index 1 -all -inline {a abc b bcd c cde} *bc*
      -> {a abc b bcd}

Updated version should just be:

  lsearch-stride 2 -index 1 -all -inline {abc abc abc bcd abc cde} *bc*
      -> abc abc abc bcd

pooryorick added on 2024-11-12 15:00:08:

Fixed in [37bcceec1e]. Thanks for catching that.


jan.nijtmans added on 2024-11-12 23:19:07:

Now merged to all branches, so can be closed.

Thanks!