diff options
-rwxr-xr-x | tkread | 22 |
1 files changed, 20 insertions, 2 deletions
@@ -60,6 +60,12 @@ set prefixfmt { \ {"###### " "0" "italic"} \ } +set listitems { \ + {\* *} \ + {- *} \ + {\+ *} \ +} + if { $::argc > 0 && [lindex $::argv 0] == "-h" } { puts "Usage: $usage" exit @@ -86,11 +92,12 @@ proc indexmovechar {str moveby} { # TODO: move each section into their own procedures proc markup {widget} { + global fontfamily + global fontsize global surroundfmt global underlinefmt global prefixfmt - global fontfamily - global fontsize + global listitems global tagnum global underlinenum global prefixnum @@ -204,6 +211,17 @@ proc markup {widget} { $widget tag configure tag_$tagnum -font "{$fontfamily} [expr $fontsize + $fmtsizemod] $fmtstring" incr tagnum } + + # process lists + foreach item $listitems { + set cur [$widget search -count len -regexp "^$item" 0.0 end] + while {$cur != ""} { + set dotindex [string first . $cur] + set linenum [string range $cur 0 [expr $dotindex - 1]] + $widget replace $linenum.0 $linenum.$len "• " + set cur [$widget search -regexp "^$item" 0.0 end] + } + } } proc changeFontSize {change} { |