diff options
Diffstat (limited to 'library/text.tcl')
-rw-r--r-- | library/text.tcl | 82 |
1 files changed, 13 insertions, 69 deletions
diff --git a/library/text.tcl b/library/text.tcl index c609665..e59a86e 100644 --- a/library/text.tcl +++ b/library/text.tcl @@ -3,8 +3,6 @@ # This file defines the default bindings for Tk text widgets and provides # procedures that help in implementing the bindings. # -# RCS: @(#) $Id: text.tcl,v 1.46 2010/06/15 14:30:48 dkf Exp $ -# # Copyright (c) 1992-1994 The Regents of the University of California. # Copyright (c) 1994-1997 Sun Microsystems, Inc. # Copyright (c) 1998 by Scriptics Corporation. @@ -94,10 +92,10 @@ bind Text <<PrevChar>> { bind Text <<NextChar>> { tk::TextSetCursor %W insert+1displayindices } -bind Text <Up> { +bind Text <<PrevLine>> { tk::TextSetCursor %W [tk::TextUpDownLine %W -1] } -bind Text <Down> { +bind Text <<NextLine>> { tk::TextSetCursor %W [tk::TextUpDownLine %W 1] } bind Text <<SelectPrevChar>> { @@ -106,10 +104,10 @@ bind Text <<SelectPrevChar>> { bind Text <<SelectNextChar>> { tk::TextKeySelect %W [%W index {insert + 1displayindices}] } -bind Text <Shift-Up> { +bind Text <<SelectPrevLine>> { tk::TextKeySelect %W [tk::TextUpDownLine %W -1] } -bind Text <Shift-Down> { +bind Text <<SelectNextLine>> { tk::TextKeySelect %W [tk::TextUpDownLine %W 1] } bind Text <<PrevWord>> { @@ -118,10 +116,10 @@ bind Text <<PrevWord>> { bind Text <<NextWord>> { tk::TextSetCursor %W [tk::TextNextWord %W insert] } -bind Text <Control-Up> { +bind Text <<PrevPara>> { tk::TextSetCursor %W [tk::TextPrevPara %W insert] } -bind Text <Control-Down> { +bind Text <<NextPara>> { tk::TextSetCursor %W [tk::TextNextPara %W insert] } bind Text <<SelectPrevWord>> { @@ -130,10 +128,10 @@ bind Text <<SelectPrevWord>> { bind Text <<SelectNextWord>> { tk::TextKeySelect %W [tk::TextNextWord %W insert] } -bind Text <Shift-Control-Up> { +bind Text <<SelectPrevPara>> { tk::TextKeySelect %W [tk::TextPrevPara %W insert] } -bind Text <Shift-Control-Down> { +bind Text <<SelectNextPara>> { tk::TextKeySelect %W [tk::TextNextPara %W insert] } bind Text <Prior> { @@ -242,10 +240,10 @@ bind Text <Shift-Select> { set tk::Priv(selectMode) char tk::TextKeyExtend %W insert } -bind Text <Control-slash> { +bind Text <<SelectAll>> { %W tag add sel 1.0 end } -bind Text <Control-backslash> { +bind Text <<SelectNone>> { %W tag remove sel 1.0 end } bind Text <<Cut>> { @@ -289,31 +287,11 @@ if {[tk windowingsystem] eq "aqua"} { # Additional emacs-like bindings: -bind Text <Control-a> { - if {!$tk_strictMotif} { - tk::TextSetCursor %W {insert display linestart} - } -} -bind Text <Control-b> { - if {!$tk_strictMotif} { - tk::TextSetCursor %W insert-1displayindices - } -} bind Text <Control-d> { if {!$tk_strictMotif && [%W compare end != insert+1c]} { %W delete insert } } -bind Text <Control-e> { - if {!$tk_strictMotif} { - tk::TextSetCursor %W {insert display lineend} - } -} -bind Text <Control-f> { - if {!$tk_strictMotif} { - tk::TextSetCursor %W insert+1displayindices - } -} bind Text <Control-k> { if {!$tk_strictMotif && [%W compare end != insert+1c]} { if {[%W compare insert == {insert lineend}]} { @@ -323,22 +301,12 @@ bind Text <Control-k> { } } } -bind Text <Control-n> { - if {!$tk_strictMotif} { - tk::TextSetCursor %W [tk::TextUpDownLine %W 1] - } -} bind Text <Control-o> { if {!$tk_strictMotif} { %W insert insert \n %W mark set insert insert-1c } } -bind Text <Control-p> { - if {!$tk_strictMotif} { - tk::TextSetCursor %W [tk::TextUpDownLine %W -1] - } -} bind Text <Control-t> { if {!$tk_strictMotif} { tk::TextTranspose %W @@ -392,31 +360,7 @@ bind Text <Meta-Delete> { # Macintosh only bindings: if {[tk windowingsystem] eq "aqua"} { -bind Text <Option-Left> { - tk::TextSetCursor %W [tk::TextPrevPos %W insert tcl_startOfPreviousWord] -} -bind Text <Option-Right> { - tk::TextSetCursor %W [tk::TextNextWord %W insert] -} -bind Text <Option-Up> { - tk::TextSetCursor %W [tk::TextPrevPara %W insert] -} -bind Text <Option-Down> { - tk::TextSetCursor %W [tk::TextNextPara %W insert] -} -bind Text <Shift-Option-Left> { - tk::TextKeySelect %W [tk::TextPrevPos %W insert tcl_startOfPreviousWord] -} -bind Text <Shift-Option-Right> { - tk::TextKeySelect %W [tk::TextNextWord %W insert] -} -bind Text <Shift-Option-Up> { - tk::TextKeySelect %W [tk::TextPrevPara %W insert] -} -bind Text <Shift-Option-Down> { - tk::TextKeySelect %W [tk::TextNextPara %W insert] -} -bind Text <Control-v> { +bind Text <<Paste>> { tk::TextScrollPages %W 1 } @@ -562,7 +506,7 @@ proc ::tk::TextButton1 {w x y} { } # Allow focus in any case on Windows, because that will let the # selection be displayed even for state disabled text widgets. - if {$::tcl_platform(platform) eq "windows" \ + if {[tk windowingsystem] eq "win32" \ || [$w cget -state] eq "normal"} { focus $w } @@ -1120,7 +1064,7 @@ proc ::tk_textPaste w { # w - The text window in which the cursor is to move. # start - Position at which to start search. -if {$tcl_platform(platform) eq "windows"} { +if {[tk windowingsystem] eq "win32"} { proc ::tk::TextNextWord {w start} { TextNextPos $w [TextNextPos $w $start tcl_endOfWord] \ tcl_startOfNextWord |