summaryrefslogtreecommitdiffstats
path: root/library/text.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'library/text.tcl')
-rw-r--r--library/text.tcl64
1 files changed, 43 insertions, 21 deletions
diff --git a/library/text.tcl b/library/text.tcl
index d4ff18e..32fd9ad 100644
--- a/library/text.tcl
+++ b/library/text.tcl
@@ -86,10 +86,10 @@ bind Text <ButtonRelease-1> {
bind Text <Control-1> {
%W mark set insert @%x,%y
}
-bind Text <Left> {
+bind Text <<PrevChar>> {
tk::TextSetCursor %W insert-1displayindices
}
-bind Text <Right> {
+bind Text <<NextChar>> {
tk::TextSetCursor %W insert+1displayindices
}
bind Text <Up> {
@@ -98,10 +98,10 @@ bind Text <Up> {
bind Text <Down> {
tk::TextSetCursor %W [tk::TextUpDownLine %W 1]
}
-bind Text <Shift-Left> {
+bind Text <<SelectPrevChar>> {
tk::TextKeySelect %W [%W index {insert - 1displayindices}]
}
-bind Text <Shift-Right> {
+bind Text <<SelectNextChar>> {
tk::TextKeySelect %W [%W index {insert + 1displayindices}]
}
bind Text <Shift-Up> {
@@ -110,10 +110,10 @@ bind Text <Shift-Up> {
bind Text <Shift-Down> {
tk::TextKeySelect %W [tk::TextUpDownLine %W 1]
}
-bind Text <Control-Left> {
+bind Text <<PrevWord>> {
tk::TextSetCursor %W [tk::TextPrevPos %W insert tcl_startOfPreviousWord]
}
-bind Text <Control-Right> {
+bind Text <<NextWord>> {
tk::TextSetCursor %W [tk::TextNextWord %W insert]
}
bind Text <Control-Up> {
@@ -122,10 +122,10 @@ bind Text <Control-Up> {
bind Text <Control-Down> {
tk::TextSetCursor %W [tk::TextNextPara %W insert]
}
-bind Text <Shift-Control-Left> {
+bind Text <<SelectPrevWord>> {
tk::TextKeySelect %W [tk::TextPrevPos %W insert tcl_startOfPreviousWord]
}
-bind Text <Shift-Control-Right> {
+bind Text <<SelectNextWord>> {
tk::TextKeySelect %W [tk::TextNextWord %W insert]
}
bind Text <Shift-Control-Up> {
@@ -153,16 +153,16 @@ bind Text <Control-Next> {
%W xview scroll 1 page
}
-bind Text <Home> {
+bind Text <<LineStart>> {
tk::TextSetCursor %W {insert display linestart}
}
-bind Text <Shift-Home> {
+bind Text <<SelectLineStart>> {
tk::TextKeySelect %W {insert display linestart}
}
-bind Text <End> {
+bind Text <<LineEnd>> {
tk::TextSetCursor %W {insert display lineend}
}
-bind Text <Shift-End> {
+bind Text <<SelectLineEnd>> {
tk::TextKeySelect %W {insert display lineend}
}
bind Text <Control-Home> {
@@ -208,18 +208,22 @@ bind Text <Return> {
bind Text <Delete> {
if {[tk::TextCursorInSelection %W]} {
%W delete sel.first sel.last
- } elseif {[%W compare end != insert+1c]} {
- %W delete insert
+ } else {
+ if {[%W compare end != insert+1c]} {
+ %W delete insert
+ }
+ %W see insert
}
- %W see insert
}
bind Text <BackSpace> {
if {[tk::TextCursorInSelection %W]} {
%W delete sel.first sel.last
- } elseif {[%W compare insert != 1.0]} {
- %W delete insert-1c
+ } else {
+ if {[%W compare insert != 1.0]} {
+ %W delete insert-1c
+ }
+ %W see insert
}
- %W see insert
}
bind Text <Control-space> {
@@ -469,6 +473,13 @@ if {[tk windowingsystem] eq "aqua"} {
%W yview scroll [expr {(2-%D)/3}] pixels
}
}
+ bind Text <Shift-MouseWheel> {
+ if {%D >= 0} {
+ %W xview scroll [expr {-%D/3}] pixels
+ } else {
+ %W xview scroll [expr {(2-%D)/3}] pixels
+ }
+ }
}
if {"x11" eq [tk windowingsystem]} {
@@ -486,6 +497,16 @@ if {"x11" eq [tk windowingsystem]} {
%W yview scroll 50 pixels
}
}
+ bind Text <Shift-4> {
+ if {!$tk_strictMotif} {
+ %W xview scroll -50 pixels
+ }
+ }
+ bind Text <Shift-5> {
+ if {!$tk_strictMotif} {
+ %W xview scroll 50 pixels
+ }
+ }
}
# ::tk::TextClosestGap --
@@ -873,16 +894,17 @@ proc ::tk::TextInsert {w s} {
}
set compound 0
if {[TextCursorInSelection $w]} {
- set compound [$w cget -autoseparators]
- if {$compound} {
+ set oldSeparator [$w cget -autoseparators]
+ if {$oldSeparator} {
$w configure -autoseparators 0
$w edit separator
+ set compound 1
}
$w delete sel.first sel.last
}
$w insert insert $s
$w see insert
- if {$compound} {
+ if {$compound && $oldSeparator} {
$w edit separator
$w configure -autoseparators 1
}