Import Tk 8.6.11
This commit is contained in:
@@ -58,7 +58,7 @@ bind Entry <<Paste>> {
|
||||
}
|
||||
bind Entry <<Clear>> {
|
||||
# ignore if there is no selection
|
||||
catch { %W delete sel.first sel.last }
|
||||
catch {%W delete sel.first sel.last}
|
||||
}
|
||||
bind Entry <<PasteSelection>> {
|
||||
if {$tk_strictMotif || ![info exists tk::Priv(mouseMoved)]
|
||||
@@ -74,7 +74,7 @@ bind Entry <<TraverseIn>> {
|
||||
|
||||
# Standard Motif bindings:
|
||||
|
||||
bind Entry <1> {
|
||||
bind Entry <Button-1> {
|
||||
tk::EntryButton1 %W %x
|
||||
%W selection clear
|
||||
}
|
||||
@@ -82,25 +82,25 @@ bind Entry <B1-Motion> {
|
||||
set tk::Priv(x) %x
|
||||
tk::EntryMouseSelect %W %x
|
||||
}
|
||||
bind Entry <Double-1> {
|
||||
bind Entry <Double-Button-1> {
|
||||
set tk::Priv(selectMode) word
|
||||
tk::EntryMouseSelect %W %x
|
||||
catch {%W icursor sel.last}
|
||||
}
|
||||
bind Entry <Triple-1> {
|
||||
bind Entry <Triple-Button-1> {
|
||||
set tk::Priv(selectMode) line
|
||||
tk::EntryMouseSelect %W %x
|
||||
catch {%W icursor sel.last}
|
||||
}
|
||||
bind Entry <Shift-1> {
|
||||
bind Entry <Shift-Button-1> {
|
||||
set tk::Priv(selectMode) char
|
||||
%W selection adjust @%x
|
||||
}
|
||||
bind Entry <Double-Shift-1> {
|
||||
bind Entry <Double-Shift-Button-1> {
|
||||
set tk::Priv(selectMode) word
|
||||
tk::EntryMouseSelect %W %x
|
||||
}
|
||||
bind Entry <Triple-Shift-1> {
|
||||
bind Entry <Triple-Shift-Button-1> {
|
||||
set tk::Priv(selectMode) line
|
||||
tk::EntryMouseSelect %W %x
|
||||
}
|
||||
@@ -114,22 +114,22 @@ bind Entry <B1-Enter> {
|
||||
bind Entry <ButtonRelease-1> {
|
||||
tk::CancelRepeat
|
||||
}
|
||||
bind Entry <Control-1> {
|
||||
bind Entry <Control-Button-1> {
|
||||
%W icursor @%x
|
||||
}
|
||||
|
||||
bind Entry <<PrevChar>> {
|
||||
tk::EntrySetCursor %W [expr {[%W index insert] - 1}]
|
||||
tk::EntrySetCursor %W [expr {[%W index insert]-1}]
|
||||
}
|
||||
bind Entry <<NextChar>> {
|
||||
tk::EntrySetCursor %W [expr {[%W index insert] + 1}]
|
||||
tk::EntrySetCursor %W [expr {[%W index insert]+1}]
|
||||
}
|
||||
bind Entry <<SelectPrevChar>> {
|
||||
tk::EntryKeySelect %W [expr {[%W index insert] - 1}]
|
||||
tk::EntryKeySelect %W [expr {[%W index insert]-1}]
|
||||
tk::EntrySeeInsert %W
|
||||
}
|
||||
bind Entry <<SelectNextChar>> {
|
||||
tk::EntryKeySelect %W [expr {[%W index insert] + 1}]
|
||||
tk::EntryKeySelect %W [expr {[%W index insert]+1}]
|
||||
tk::EntrySeeInsert %W
|
||||
}
|
||||
bind Entry <<PrevWord>> {
|
||||
@@ -190,19 +190,19 @@ bind Entry <<SelectAll>> {
|
||||
bind Entry <<SelectNone>> {
|
||||
%W selection clear
|
||||
}
|
||||
bind Entry <KeyPress> {
|
||||
bind Entry <Key> {
|
||||
tk::CancelRepeat
|
||||
tk::EntryInsert %W %A
|
||||
}
|
||||
|
||||
# Ignore all Alt, Meta, and Control keypresses unless explicitly bound.
|
||||
# Otherwise, if a widget binding for one of these is defined, the
|
||||
# <KeyPress> class binding will also fire and insert the character,
|
||||
# <Key> class binding will also fire and insert the character,
|
||||
# which is wrong. Ditto for Escape, Return, and Tab.
|
||||
|
||||
bind Entry <Alt-KeyPress> {# nothing}
|
||||
bind Entry <Meta-KeyPress> {# nothing}
|
||||
bind Entry <Control-KeyPress> {# nothing}
|
||||
bind Entry <Alt-Key> {# nothing}
|
||||
bind Entry <Meta-Key> {# nothing}
|
||||
bind Entry <Control-Key> {# nothing}
|
||||
bind Entry <Escape> {# nothing}
|
||||
bind Entry <Return> {# nothing}
|
||||
bind Entry <KP_Enter> {# nothing}
|
||||
@@ -210,7 +210,7 @@ bind Entry <Tab> {# nothing}
|
||||
bind Entry <Prior> {# nothing}
|
||||
bind Entry <Next> {# nothing}
|
||||
if {[tk windowingsystem] eq "aqua"} {
|
||||
bind Entry <Command-KeyPress> {# nothing}
|
||||
bind Entry <Command-Key> {# nothing}
|
||||
}
|
||||
# Tk-on-Cocoa generates characters for these two keys. [Bug 2971663]
|
||||
bind Entry <<NextLine>> {# nothing}
|
||||
@@ -278,7 +278,7 @@ bind Entry <<TkStartIMEMarkedText>> {
|
||||
dict set ::tk::Priv(IMETextMark) "%W" [%W index insert]
|
||||
}
|
||||
bind Entry <<TkEndIMEMarkedText>> {
|
||||
if { [catch {dict get $::tk::Priv(IMETextMark) "%W"} mark] } {
|
||||
if {[catch {dict get $::tk::Priv(IMETextMark) "%W"} mark]} {
|
||||
bell
|
||||
} else {
|
||||
%W selection range $mark insert
|
||||
@@ -293,14 +293,27 @@ bind Entry <<TkAccentBackspace>> {
|
||||
|
||||
# A few additional bindings of my own.
|
||||
|
||||
bind Entry <2> {
|
||||
if {!$tk_strictMotif} {
|
||||
::tk::EntryScanMark %W %x
|
||||
if {[tk windowingsystem] ne "aqua"} {
|
||||
bind Entry <Button-2> {
|
||||
if {!$tk_strictMotif} {
|
||||
::tk::EntryScanMark %W %x
|
||||
}
|
||||
}
|
||||
}
|
||||
bind Entry <B2-Motion> {
|
||||
if {!$tk_strictMotif} {
|
||||
::tk::EntryScanDrag %W %x
|
||||
bind Entry <B2-Motion> {
|
||||
if {!$tk_strictMotif} {
|
||||
::tk::EntryScanDrag %W %x
|
||||
}
|
||||
}
|
||||
} else {
|
||||
bind Entry <Button-3> {
|
||||
if {!$tk_strictMotif} {
|
||||
::tk::EntryScanMark %W %x
|
||||
}
|
||||
}
|
||||
bind Entry <B3-Motion> {
|
||||
if {!$tk_strictMotif} {
|
||||
::tk::EntryScanDrag %W %x
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -378,10 +391,10 @@ proc ::tk::EntryMouseSelect {w x} {
|
||||
word {
|
||||
if {$cur < $anchor} {
|
||||
set before [tcl_wordBreakBefore [$w get] $cur]
|
||||
set after [tcl_wordBreakAfter [$w get] [expr {$anchor-1}]]
|
||||
set after [tcl_wordBreakAfter [$w get] $anchor-1]
|
||||
} elseif {$cur > $anchor} {
|
||||
set before [tcl_wordBreakBefore [$w get] $anchor]
|
||||
set after [tcl_wordBreakAfter [$w get] [expr {$cur - 1}]]
|
||||
set after [tcl_wordBreakAfter [$w get] $cur-1]
|
||||
} else {
|
||||
if {[$w index @$Priv(pressX)] < $anchor} {
|
||||
incr anchor -1
|
||||
@@ -505,9 +518,9 @@ proc ::tk::EntryBackspace w {
|
||||
if {[$w selection present]} {
|
||||
$w delete sel.first sel.last
|
||||
} else {
|
||||
set x [expr {[$w index insert] - 1}]
|
||||
if {$x >= 0} {
|
||||
$w delete $x
|
||||
set x [$w index insert]
|
||||
if {$x > 0} {
|
||||
$w delete [expr {$x-1}]
|
||||
}
|
||||
if {[$w index @0] >= [$w index insert]} {
|
||||
set range [$w xview]
|
||||
@@ -562,12 +575,12 @@ proc ::tk::EntryTranspose w {
|
||||
if {$i < [$w index end]} {
|
||||
incr i
|
||||
}
|
||||
set first [expr {$i-2}]
|
||||
if {$first < 0} {
|
||||
if {$i < 2} {
|
||||
return
|
||||
}
|
||||
set first [expr {$i-2}]
|
||||
set data [$w get]
|
||||
set new [string index $data [expr {$i-1}]][string index $data $first]
|
||||
set new [string index $data $i-1][string index $data $first]
|
||||
$w delete $first $i
|
||||
$w insert insert $new
|
||||
EntrySeeInsert $w
|
||||
@@ -647,7 +660,7 @@ proc ::tk::EntryScanMark {w x} {
|
||||
proc ::tk::EntryScanDrag {w x} {
|
||||
# Make sure these exist, as some weird situations can trigger the
|
||||
# motion binding without the initial press. [Bug #220269]
|
||||
if {![info exists ::tk::Priv(x)]} { set ::tk::Priv(x) $x }
|
||||
if {![info exists ::tk::Priv(x)]} {set ::tk::Priv(x) $x}
|
||||
# allow for a delta
|
||||
if {abs($x-$::tk::Priv(x)) > 2} {
|
||||
set ::tk::Priv(mouseMoved) 1
|
||||
@@ -664,19 +677,10 @@ proc ::tk::EntryScanDrag {w x} {
|
||||
|
||||
proc ::tk::EntryGetSelection {w} {
|
||||
set entryString [string range [$w get] [$w index sel.first] \
|
||||
[expr {[$w index sel.last] - 1}]]
|
||||
[$w index sel.last]-1]
|
||||
if {[$w cget -show] ne ""} {
|
||||
return [string repeat [string index [$w cget -show] 0] \
|
||||
[string length $entryString]]
|
||||
}
|
||||
return $entryString
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user