summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick White <git@njw.me.uk>2014-02-25 09:46:52 +0000
committerNick White <git@njw.me.uk>2014-02-25 09:46:52 +0000
commit2a2919d9d26756e898a6fec0572ca01acbaff24b (patch)
tree00481e9630fa87b1baf028f7f227ff07de3e3740
parentf4072e6a86f761c9f9b02359c7ca02e5a9559fe8 (diff)
downloadtkread-2a2919d9d26756e898a6fec0572ca01acbaff24b.tar.bz2
tkread-2a2919d9d26756e898a6fec0572ca01acbaff24b.zip
Process lists
-rwxr-xr-xtkread22
1 files 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} {