aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--library/zincText.tcl27
1 files changed, 13 insertions, 14 deletions
diff --git a/library/zincText.tcl b/library/zincText.tcl
index 6372c1f..e193161 100644
--- a/library/zincText.tcl
+++ b/library/zincText.tcl
@@ -96,7 +96,7 @@ proc pasteSel {w x y} {
set item [$w focus]
if {[llength $item] != 0} {
- catch {$w insert $item @$x,$y [selection get]}
+ catch {$w insert [lindex $item 0] [lindex $item 1] @$x,$y [selection get]}
}
}
@@ -105,7 +105,6 @@ proc insertChar {w c} {
set item [$w focus]
set selItem [$w select item]
- puts "item: $item, selItem: $selItem"
if {[llength $item] == 0} {
return;
}
@@ -113,14 +112,14 @@ proc insertChar {w c} {
if {([llength $selItem]!= 0) &&
([lindex $selItem 0] == [lindex $item 0]) &&
([lindex $selItem 1] == [lindex $item 1])} {
- $w dchars $item sel.first sel.last
+ $w dchars [lindex $item 0] [lindex $item 1] sel.first sel.last
}
- $w insert [lindex $item 0] insert $c
+ $w insert [lindex $item 0] [lindex $item 1] insert $c
}
proc insertKey {w c} {
- if {($c < 32) || ($c == 128)} {
+ if {! [binary scan $c {c} code] || ($code < 32) || ($code == 128)} {
return;
}
@@ -132,7 +131,7 @@ proc setCur {w where} {
set item [$w focus]
if {[llength $item] != 0} {
- $w cursor $item $where
+ $w cursor [lindex $item 0] [lindex $item 1] $where
}
}
@@ -141,14 +140,14 @@ proc moveCur {w dir} {
set item [$w focus]
if {[llength $item] != 0} {
- set index [$w index $item insert]
- $w cursor $item [expr $index + $dir]
+ set index [$w index [lindex $item 0] [lindex $item 1] insert]
+ $w cursor [lindex $item 0] [lindex $item 1] [expr $index + $dir]
}
}
proc startSel {w x y} {
- set part [$w currentpart 1]
+ set part [$w currentpart t]
$w cursor current $part @$x,$y
$w focus current $part
@@ -158,14 +157,14 @@ proc startSel {w x y} {
proc extendSel {w x y} {
- set part [$w currentpart 1]
+ set part [$w currentpart t]
$w select to current $part @$x,$y
}
proc textDel {w dir} {
- set item [lindex [$w focus] 0]
+ set item [$w focus]
set selItem [$w select item]
if {[llength $item] == 0} {
@@ -175,11 +174,11 @@ proc textDel {w dir} {
if {([llength $selItem] != 0) &&
([lindex $selItem 0] == [lindex $item 0]) &&
([lindex $selItem 1] == [lindex $item 1])} {
- $w dchars $item sel.first sel.last
+ $w dchars [lindex $item 0] [lindex $item 1] sel.first sel.last
} else {
- set ind [expr [$w index $item insert] + $dir]
+ set ind [expr [$w index [lindex $item 0] [lindex $item 1] insert] + $dir]
if { $ind >= 0 } {
- $w dchars $item $ind $ind
+ $w dchars [lindex $item 0] [lindex $item 1] $ind $ind
}
}
}