#definition text -> list of records (factored out of resolve - G-046)
#records are delimited by newlines, but multiline values are allowed if properly
#quoted/braced - 'info complete' (on ansi-stripped accumulation) finds record ends.
set records [list]
set linebuild ""
set linelist [split $optionspecs \n]
set record_base_indent "" ;#indent of first line in the record e.g a parameter or @directive record which will often have subsequent lines further indented.
#find the first record's base indent
foreach ln $linelist {
if {[tcl::string::trim $ln] eq ""} {continue}
regexp {(\s*).*} $ln _all record_base_indent
break ;#break at first non-empty
}
set in_record_continuation 0
if {[catch {package require punk::ansi} errM]} {
set has_punkansi 0
} else {
set has_punkansi 1
}
set record_id 0
set record_line 0 ;#incremented at each incomplete record, set to zero after processing a complete record
foreach rawline $linelist {
set record_so_far [tcl::string::cat $linebuild $rawline]
#ansi colours can stop info complete from working (contain square brackets)
#review - when exactly are ansi codes allowed/expected in record lines.
# - we might reasonably expect them in default values or choices or help strings
# - square brackets in ansi aren't and can't be escaped if they're to work as literals in the data.
# - eg set line "set x \"a[a+ red]red[a]\""
# - 'info complete' will report 0, and subst would require -nocommand option or it will complain of missing close-bracket
if {$has_punkansi} {
set test_record [punk::ansi::ansistrip $record_so_far]
} else {
#review
#we only need to strip enough to stop interference with 'info complete'
set test_record [string map [list \x1b\[ ""] $record_so_far]
}
if {![tcl::info::complete $test_record]} {
if {$in_record_continuation} {
#trim only the whitespace corresponding to the record indent - not all whitespace on left
#this allows alignment of multiline help strings to left margin whilst maintaining a visual indent in source form.
#(note string first "" $str is fast and returns -1)
if {[tcl::string::first $record_base_indent $rawline] == 0} {
set trimmedline [tcl::string::range $rawline [tcl::string::length $record_base_indent] end]
#first process dashed and non-dashed record names without regard to whether non-dashed are at the beginning or end
#first process dashed and non-dashed record names without regard to whether non-dashed are at the beginning or end
set records [list]
set records [private::split_definition_records $optionspecs]
set linebuild ""
set linelist [split $optionspecs \n]
set record_base_indent "" ;#indent of first line in the record e.g a parameter or @directive record which will often have subsequent lines further indented.
#definition text -> list of records (factored out of resolve - G-046)
#records are delimited by newlines, but multiline values are allowed if properly
#quoted/braced - 'info complete' (on ansi-stripped accumulation) finds record ends.
set records [list]
set linebuild ""
set linelist [split $optionspecs \n]
set record_base_indent "" ;#indent of first line in the record e.g a parameter or @directive record which will often have subsequent lines further indented.
#find the first record's base indent
foreach ln $linelist {
if {[tcl::string::trim $ln] eq ""} {continue}
regexp {(\s*).*} $ln _all record_base_indent
break ;#break at first non-empty
}
set in_record_continuation 0
if {[catch {package require punk::ansi} errM]} {
set has_punkansi 0
} else {
set has_punkansi 1
}
set record_id 0
set record_line 0 ;#incremented at each incomplete record, set to zero after processing a complete record
foreach rawline $linelist {
set record_so_far [tcl::string::cat $linebuild $rawline]
#ansi colours can stop info complete from working (contain square brackets)
#review - when exactly are ansi codes allowed/expected in record lines.
# - we might reasonably expect them in default values or choices or help strings
# - square brackets in ansi aren't and can't be escaped if they're to work as literals in the data.
# - eg set line "set x \"a[a+ red]red[a]\""
# - 'info complete' will report 0, and subst would require -nocommand option or it will complain of missing close-bracket
if {$has_punkansi} {
set test_record [punk::ansi::ansistrip $record_so_far]
} else {
#review
#we only need to strip enough to stop interference with 'info complete'
set test_record [string map [list \x1b\[ ""] $record_so_far]
}
if {![tcl::info::complete $test_record]} {
if {$in_record_continuation} {
#trim only the whitespace corresponding to the record indent - not all whitespace on left
#this allows alignment of multiline help strings to left margin whilst maintaining a visual indent in source form.
#(note string first "" $str is fast and returns -1)
if {[tcl::string::first $record_base_indent $rawline] == 0} {
set trimmedline [tcl::string::range $rawline [tcl::string::length $record_base_indent] end]
#first process dashed and non-dashed record names without regard to whether non-dashed are at the beginning or end
#first process dashed and non-dashed record names without regard to whether non-dashed are at the beginning or end
set records [list]
set records [private::split_definition_records $optionspecs]
set linebuild ""
set linelist [split $optionspecs \n]
set record_base_indent "" ;#indent of first line in the record e.g a parameter or @directive record which will often have subsequent lines further indented.
#definition text -> list of records (factored out of resolve - G-046)
#records are delimited by newlines, but multiline values are allowed if properly
#quoted/braced - 'info complete' (on ansi-stripped accumulation) finds record ends.
set records [list]
set linebuild ""
set linelist [split $optionspecs \n]
set record_base_indent "" ;#indent of first line in the record e.g a parameter or @directive record which will often have subsequent lines further indented.
#find the first record's base indent
foreach ln $linelist {
if {[tcl::string::trim $ln] eq ""} {continue}
regexp {(\s*).*} $ln _all record_base_indent
break ;#break at first non-empty
}
set in_record_continuation 0
if {[catch {package require punk::ansi} errM]} {
set has_punkansi 0
} else {
set has_punkansi 1
}
set record_id 0
set record_line 0 ;#incremented at each incomplete record, set to zero after processing a complete record
foreach rawline $linelist {
set record_so_far [tcl::string::cat $linebuild $rawline]
#ansi colours can stop info complete from working (contain square brackets)
#review - when exactly are ansi codes allowed/expected in record lines.
# - we might reasonably expect them in default values or choices or help strings
# - square brackets in ansi aren't and can't be escaped if they're to work as literals in the data.
# - eg set line "set x \"a[a+ red]red[a]\""
# - 'info complete' will report 0, and subst would require -nocommand option or it will complain of missing close-bracket
if {$has_punkansi} {
set test_record [punk::ansi::ansistrip $record_so_far]
} else {
#review
#we only need to strip enough to stop interference with 'info complete'
set test_record [string map [list \x1b\[ ""] $record_so_far]
}
if {![tcl::info::complete $test_record]} {
if {$in_record_continuation} {
#trim only the whitespace corresponding to the record indent - not all whitespace on left
#this allows alignment of multiline help strings to left margin whilst maintaining a visual indent in source form.
#(note string first "" $str is fast and returns -1)
if {[tcl::string::first $record_base_indent $rawline] == 0} {
set trimmedline [tcl::string::range $rawline [tcl::string::length $record_base_indent] end]
#first process dashed and non-dashed record names without regard to whether non-dashed are at the beginning or end
#first process dashed and non-dashed record names without regard to whether non-dashed are at the beginning or end
set records [list]
set records [private::split_definition_records $optionspecs]
set linebuild ""
set linelist [split $optionspecs \n]
set record_base_indent "" ;#indent of first line in the record e.g a parameter or @directive record which will often have subsequent lines further indented.
#definition text -> list of records (factored out of resolve - G-046)
#records are delimited by newlines, but multiline values are allowed if properly
#quoted/braced - 'info complete' (on ansi-stripped accumulation) finds record ends.
set records [list]
set linebuild ""
set linelist [split $optionspecs \n]
set record_base_indent "" ;#indent of first line in the record e.g a parameter or @directive record which will often have subsequent lines further indented.
#find the first record's base indent
foreach ln $linelist {
if {[tcl::string::trim $ln] eq ""} {continue}
regexp {(\s*).*} $ln _all record_base_indent
break ;#break at first non-empty
}
set in_record_continuation 0
if {[catch {package require punk::ansi} errM]} {
set has_punkansi 0
} else {
set has_punkansi 1
}
set record_id 0
set record_line 0 ;#incremented at each incomplete record, set to zero after processing a complete record
foreach rawline $linelist {
set record_so_far [tcl::string::cat $linebuild $rawline]
#ansi colours can stop info complete from working (contain square brackets)
#review - when exactly are ansi codes allowed/expected in record lines.
# - we might reasonably expect them in default values or choices or help strings
# - square brackets in ansi aren't and can't be escaped if they're to work as literals in the data.
# - eg set line "set x \"a[a+ red]red[a]\""
# - 'info complete' will report 0, and subst would require -nocommand option or it will complain of missing close-bracket
if {$has_punkansi} {
set test_record [punk::ansi::ansistrip $record_so_far]
} else {
#review
#we only need to strip enough to stop interference with 'info complete'
set test_record [string map [list \x1b\[ ""] $record_so_far]
}
if {![tcl::info::complete $test_record]} {
if {$in_record_continuation} {
#trim only the whitespace corresponding to the record indent - not all whitespace on left
#this allows alignment of multiline help strings to left margin whilst maintaining a visual indent in source form.
#(note string first "" $str is fast and returns -1)
if {[tcl::string::first $record_base_indent $rawline] == 0} {
set trimmedline [tcl::string::range $rawline [tcl::string::length $record_base_indent] end]
#first process dashed and non-dashed record names without regard to whether non-dashed are at the beginning or end
#first process dashed and non-dashed record names without regard to whether non-dashed are at the beginning or end
set records [list]
set records [private::split_definition_records $optionspecs]
set linebuild ""
set linelist [split $optionspecs \n]
set record_base_indent "" ;#indent of first line in the record e.g a parameter or @directive record which will often have subsequent lines further indented.