summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick White <git@njw.name>2015-05-21 10:16:17 +0100
committerNick White <git@njw.name>2015-05-21 10:16:17 +0100
commit14cd447c1446eaa31505f7e5e8c9ef54ff28e465 (patch)
tree16cdeacafed97b26462ea6f3ecfcbf0e0c15b674
parent33f26d42e274392c060e69cb6e1e02a75a1273e0 (diff)
downloadtkread-14cd447c1446eaa31505f7e5e8c9ef54ff28e465.tar.bz2
tkread-14cd447c1446eaa31505f7e5e8c9ef54ff28e465.zip
Don't delete then re-add link alt text, as it removes images that are links
-rwxr-xr-xtkread9
1 files changed, 4 insertions, 5 deletions
diff --git a/tkread b/tkread
index 5a3038c..93efa40 100755
--- a/tkread
+++ b/tkread
@@ -187,7 +187,7 @@ proc markup {widget} {
set cur [$widget search "](" $cur end]
if {$cur == ""} { break }
set altend $cur
- set srcstart [indexmovechar $cur "+ 1"]
+ set srcstart [indexmovechar $cur "+ 2"]
set cur [$widget search ")" $cur end]
if {$cur == ""} { break }
set srcend $cur
@@ -195,11 +195,10 @@ proc markup {widget} {
set alt [$widget get $altstart $altend]
set src [$widget get $srcstart $srcend]
- $widget delete [indexmovechar $altstart "- 1"] [indexmovechar $srcend "+ 1"]
- set insertion [indexmovechar $altstart "- 1"]
- $widget insert $insertion $alt
+ $widget delete $altend [indexmovechar $srcend "+ 1"]
+ $widget delete [indexmovechar $altstart "- 1"] $altstart
- set cur [indexmovechar $insertion "+ [string length $alt]"]
+ set cur [indexmovechar $altend "- 1"]
set cur [$widget search {[} $cur end]
}