diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2024-01-26 16:17:54 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2024-01-26 16:17:54 (GMT) |
commit | 1fd741b0b4c30061a7a61056f53dd0421e9353b4 (patch) | |
tree | 6e8dba4a5b090302e96549140aad93d02935d301 /library | |
parent | 72a067940cab76f22c624a22de728847d2deadc4 (diff) | |
download | tk-1fd741b0b4c30061a7a61056f53dd0421e9353b4.zip tk-1fd741b0b4c30061a7a61056f53dd0421e9353b4.tar.gz tk-1fd741b0b4c30061a7a61056f53dd0421e9353b4.tar.bz2 |
Possible fix for [55e742aea6]: In text, Ctrl+Left and Ctrl+Right behave different in Windows and Linux.
Text-widget only (for now). Entry and Spinbox will need the same change. For discussion.
Diffstat (limited to 'library')
-rw-r--r-- | library/text.tcl | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/library/text.tcl b/library/text.tcl index 99d5841..15bdef2 100644 --- a/library/text.tcl +++ b/library/text.tcl @@ -138,7 +138,7 @@ bind Text <<SelectPrevWord>> { tk::TextKeySelect %W [tk::TextPrevPos %W insert tk::startOfPreviousWord] } bind Text <<SelectNextWord>> { - tk::TextKeySelect %W [tk::TextNextWord %W insert] + tk::TextKeySelect %W [tk::TextSelectNextWord %W insert] } bind Text <<SelectPrevPara>> { tk::TextKeySelect %W [tk::TextPrevPara %W insert] @@ -1086,26 +1086,31 @@ proc ::tk_textPaste w { } # ::tk::TextNextWord -- -# Returns the index of the next word position after a given position in the -# text. The next word is platform dependent and may be either the next -# end-of-word position or the next start-of-word position after the next -# end-of-word position. +# Returns the index of the next start-of-word position after the next +# end-of-word position after a given position in the text. # # Arguments: # w - The text window in which the cursor is to move. # start - Position at which to start search. -if {[tk windowingsystem] eq "win32"} { - proc ::tk::TextNextWord {w start} { - TextNextPos $w [TextNextPos $w $start tk::endOfWord] \ - tk::startOfNextWord - } -} else { - proc ::tk::TextNextWord {w start} { - TextNextPos $w $start tk::endOfWord - } +proc ::tk::TextNextWord {w start} { + TextNextPos $w [TextNextPos $w $start tk::endOfWord] \ + tk::startOfNextWord +} + +# ::tk::TextSelectNextWord -- +# Returns the index of the next end-of-word position after a given +# position in the text. +# +# Arguments: +# w - The text window in which the cursor is to move. +# start - Position at which to start search. + +proc ::tk::TextSelectNextWord {w start} { + TextNextPos $w $start tk::endOfWord } + # ::tk::TextNextPos -- # Returns the index of the next position after the given starting # position in the text as computed by a specified function. |