From 2a2919d9d26756e898a6fec0572ca01acbaff24b Mon Sep 17 00:00:00 2001 From: Nick White Date: Tue, 25 Feb 2014 09:46:52 +0000 Subject: Process lists --- tkread | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/tkread b/tkread index 5fbce76..126156f 100755 --- a/tkread +++ b/tkread @@ -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} { -- cgit v1.2.3