summaryrefslogtreecommitdiffstats
path: root/library/entry.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'library/entry.tcl')
-rw-r--r--library/entry.tcl64
1 files changed, 32 insertions, 32 deletions
diff --git a/library/entry.tcl b/library/entry.tcl
index 4a0b764..3a86498 100644
--- a/library/entry.tcl
+++ b/library/entry.tcl
@@ -34,7 +34,7 @@
bind Entry <<Cut>> {
if {![catch {set data [string range [%W get] [%W index sel.first]\
- [expr [%W index sel.last] - 1]]}]} {
+ [expr {[%W index sel.last] - 1}]]}]} {
clipboard clear -displayof %W
clipboard append -displayof %W $data
%W delete sel.first sel.last
@@ -42,7 +42,7 @@ bind Entry <<Cut>> {
}
bind Entry <<Copy>> {
if {![catch {set data [string range [%W get] [%W index sel.first]\
- [expr [%W index sel.last] - 1]]}]} {
+ [expr {[%W index sel.last] - 1}]]}]} {
clipboard clear -displayof %W
clipboard append -displayof %W $data
}
@@ -115,17 +115,17 @@ bind Entry <ButtonRelease-2> {
}
bind Entry <Left> {
- tkEntrySetCursor %W [expr [%W index insert] - 1]
+ tkEntrySetCursor %W [expr {[%W index insert] - 1}]
}
bind Entry <Right> {
- tkEntrySetCursor %W [expr [%W index insert] + 1]
+ tkEntrySetCursor %W [expr {[%W index insert] + 1}]
}
bind Entry <Shift-Left> {
- tkEntryKeySelect %W [expr [%W index insert] - 1]
+ tkEntryKeySelect %W [expr {[%W index insert] - 1}]
tkEntrySeeInsert %W
}
bind Entry <Shift-Right> {
- tkEntryKeySelect %W [expr [%W index insert] + 1]
+ tkEntryKeySelect %W [expr {[%W index insert] + 1}]
tkEntrySeeInsert %W
}
bind Entry <Control-Left> {
@@ -158,7 +158,7 @@ bind Entry <Shift-End> {
}
bind Entry <Delete> {
- if [%W selection present] {
+ if {[%W selection present]} {
%W delete sel.first sel.last
} else {
%W delete insert
@@ -213,67 +213,67 @@ bind Entry <Insert> {
# Additional emacs-like bindings:
bind Entry <Control-a> {
- if !$tk_strictMotif {
+ if {!$tk_strictMotif} {
tkEntrySetCursor %W 0
}
}
bind Entry <Control-b> {
- if !$tk_strictMotif {
- tkEntrySetCursor %W [expr [%W index insert] - 1]
+ if {!$tk_strictMotif} {
+ tkEntrySetCursor %W [expr {[%W index insert] - 1}]
}
}
bind Entry <Control-d> {
- if !$tk_strictMotif {
+ if {!$tk_strictMotif} {
%W delete insert
}
}
bind Entry <Control-e> {
- if !$tk_strictMotif {
+ if {!$tk_strictMotif} {
tkEntrySetCursor %W end
}
}
bind Entry <Control-f> {
- if !$tk_strictMotif {
- tkEntrySetCursor %W [expr [%W index insert] + 1]
+ if {!$tk_strictMotif} {
+ tkEntrySetCursor %W [expr {[%W index insert] + 1}]
}
}
bind Entry <Control-h> {
- if !$tk_strictMotif {
+ if {!$tk_strictMotif} {
tkEntryBackspace %W
}
}
bind Entry <Control-k> {
- if !$tk_strictMotif {
+ if {!$tk_strictMotif} {
%W delete insert end
}
}
bind Entry <Control-t> {
- if !$tk_strictMotif {
+ if {!$tk_strictMotif} {
tkEntryTranspose %W
}
}
bind Entry <Meta-b> {
- if !$tk_strictMotif {
+ if {!$tk_strictMotif} {
tkEntrySetCursor %W [tkEntryPreviousWord %W insert]
}
}
bind Entry <Meta-d> {
- if !$tk_strictMotif {
+ if {!$tk_strictMotif} {
%W delete insert [tkEntryNextWord %W insert]
}
}
bind Entry <Meta-f> {
- if !$tk_strictMotif {
+ if {!$tk_strictMotif} {
tkEntrySetCursor %W [tkEntryNextWord %W insert]
}
}
bind Entry <Meta-BackSpace> {
- if !$tk_strictMotif {
+ if {!$tk_strictMotif} {
%W delete [tkEntryPreviousWord %W insert] insert
}
}
bind Entry <Meta-Delete> {
- if !$tk_strictMotif {
+ if {!$tk_strictMotif} {
%W delete [tkEntryPreviousWord %W insert] insert
}
}
@@ -281,7 +281,7 @@ bind Entry <Meta-Delete> {
# A few additional bindings of my own.
bind Entry <2> {
- if !$tk_strictMotif {
+ if {!$tk_strictMotif} {
%W scan mark %x
set tkPriv(x) %x
set tkPriv(y) %y
@@ -289,7 +289,7 @@ bind Entry <2> {
}
}
bind Entry <B2-Motion> {
- if !$tk_strictMotif {
+ if {!$tk_strictMotif} {
if {abs(%x-$tkPriv(x)) > 2} {
set tkPriv(mouseMoved) 1
}
@@ -356,7 +356,7 @@ proc tkEntryMouseSelect {w x} {
}
switch $tkPriv(selectMode) {
char {
- if $tkPriv(mouseMoved) {
+ if {$tkPriv(mouseMoved)} {
if {$cur < $anchor} {
$w selection range $cur $anchor
} elseif {$cur > $anchor} {
@@ -369,10 +369,10 @@ proc tkEntryMouseSelect {w x} {
word {
if {$cur < [$w index anchor]} {
set before [tcl_wordBreakBefore [$w get] $cur]
- set after [tcl_wordBreakAfter [$w get] [expr $anchor-1]]
+ set after [tcl_wordBreakAfter [$w get] [expr {$anchor-1}]]
} else {
set before [tcl_wordBreakBefore [$w get] $anchor]
- set after [tcl_wordBreakAfter [$w get] [expr $cur - 1]]
+ set after [tcl_wordBreakAfter [$w get] [expr {$cur - 1}]]
}
if {$before < 0} {
set before 0
@@ -440,7 +440,7 @@ proc tkEntryAutoScan {w} {
# actually been moved to this position yet).
proc tkEntryKeySelect {w new} {
- if ![$w selection present] {
+ if {![$w selection present]} {
$w selection from insert
$w selection to $new
} else {
@@ -482,7 +482,7 @@ proc tkEntryInsert {w s} {
# w - The entry window in which to backspace.
proc tkEntryBackspace w {
- if [$w selection present] {
+ if {[$w selection present]} {
$w delete sel.first sel.last
} else {
set x [expr {[$w index insert] - 1}]
@@ -491,7 +491,7 @@ proc tkEntryBackspace w {
set range [$w xview]
set left [lindex $range 0]
set right [lindex $range 1]
- $w xview moveto [expr $left - ($right - $left)/2.0]
+ $w xview moveto [expr {$left - ($right - $left)/2.0}]
}
}
}
@@ -547,11 +547,11 @@ proc tkEntryTranspose w {
if {$i < [$w index end]} {
incr i
}
- set first [expr $i-2]
+ set first [expr {$i-2}]
if {$first < 0} {
return
}
- set new [string index [$w get] [expr $i-1]][string index [$w get] $first]
+ set new [string index [$w get] [expr {$i-1}]][string index [$w get] $first]
$w delete $first $i
$w insert insert $new
tkEntrySeeInsert $w