Tk Source Code

Check-in [6929eff576]
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2018 Conference, Houston/TX, US, Oct 15-19
Send your abstracts to tclconference@googlegroups.com
or submit via the online form by Aug 20.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Implement [25df4fb275]: Control-u (delete from linestart to cursor) bindings for (ttk)entry, (ttk)spinbox, and text widgets. Patch from Stuart Cassoff.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | rfe-25df4fb275
Files: files | file ages | folders
SHA3-256:6929eff57699d0510f7651a31389808b3c91f052a1447d83fc8601c58088ebd6
User & Date: fvogel 2018-07-04 20:24:34
Context
2018-07-04
20:24
Implement [25df4fb275]: Control-u (delete from linestart to cursor) bindings for (ttk)entry, (ttk)spinbox, and text widgets. Patch from Stuart Cassoff. Leaf check-in: 6929eff576 user: fvogel tags: rfe-25df4fb275
08:46
Fix [309b426171]: ttk partly fails in Windows high-contrast-mode using wrong colors. Patch provided by cjmcdonald. check-in: 9d657700ea user: fvogel tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to doc/entry.n.

516
517
518
519
520
521
522



523
524
525
526
527
528
529
Meta-d deletes the word to the right of the insertion cursor.
.IP [22]
Control-k deletes all the characters to the right of the insertion
cursor.
.IP [23]
Control-t reverses the order of the two characters to the right of
the insertion cursor.



.PP
If the entry is disabled using the \fB\-state\fR option, then the entry's
view can still be adjusted and text in the entry can still be selected,
but no insertion cursor will be displayed and no text modifications will
take place
except if the entry is linked to a variable using the \fB\-textvariable\fR
option, in which case any changes to the variable are reflected by the







>
>
>







516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
Meta-d deletes the word to the right of the insertion cursor.
.IP [22]
Control-k deletes all the characters to the right of the insertion
cursor.
.IP [23]
Control-t reverses the order of the two characters to the right of
the insertion cursor.
.IP [24]
Control-u deletes all the characters to the left of the insertion
cursor.
.PP
If the entry is disabled using the \fB\-state\fR option, then the entry's
view can still be adjusted and text in the entry can still be selected,
but no insertion cursor will be displayed and no text modifications will
take place
except if the entry is linked to a variable using the \fB\-textvariable\fR
option, in which case any changes to the variable are reflected by the

Changes to doc/spinbox.n.

584
585
586
587
588
589
590



591
592
593
594
595
596
597
Meta-d deletes the word to the right of the insertion cursor.
.IP [22]
Control-k deletes all the characters to the right of the insertion
cursor.
.IP [23]
Control-t reverses the order of the two characters to the right of
the insertion cursor.



.PP
If the spinbox is disabled using the \fB\-state\fR option, then the spinbox's
view can still be adjusted and text in the spinbox can still be selected,
but no insertion cursor will be displayed and no text modifications will
take place.
.PP
The behavior of spinboxes can be changed by defining new bindings for







>
>
>







584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
Meta-d deletes the word to the right of the insertion cursor.
.IP [22]
Control-k deletes all the characters to the right of the insertion
cursor.
.IP [23]
Control-t reverses the order of the two characters to the right of
the insertion cursor.
.IP [24]
Control-u deletes all the characters to the left of the insertion
cursor.
.PP
If the spinbox is disabled using the \fB\-state\fR option, then the spinbox's
view can still be adjusted and text in the spinbox can still be selected,
but no insertion cursor will be displayed and no text modifications will
take place.
.PP
The behavior of spinboxes can be changed by defining new bindings for

Changes to doc/text.n.

2156
2157
2158
2159
2160
2161
2162




2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
.IP [29]
Meta-backspace and Meta-Delete delete the word to the left of the insertion
cursor.
.IP [30]
Control-t reverses the order of the two characters to the right of the
insertion cursor.
.IP [31]




Control-x deletes whatever is selected in the text widget after copying it to
the clipboard.
.IP [32]
Control-z undoes the last edit action if the \fB\-undo\fR option is true.
Does nothing otherwise.
.IP [33]
Control-Z (or Control-y on Windows) reapplies the last undone edit action if
the \fB\-undo\fR option is true. Does nothing otherwise.
.PP
If the widget is disabled using the \fB\-state\fR option, then its view can
still be adjusted and text can still be selected, but no insertion cursor will
be displayed and no text modifications will take place.
.PP







>
>
>
>


|


|







2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
.IP [29]
Meta-backspace and Meta-Delete delete the word to the left of the insertion
cursor.
.IP [30]
Control-t reverses the order of the two characters to the right of the
insertion cursor.
.IP [31]
Control-u deletes to the insertion cursor from the beginning of its line; if the
insertion cursor is already at the beginning of a line, then Control-u deletes
the character to the left of the insertion cursor.
.IP [32]
Control-x deletes whatever is selected in the text widget after copying it to
the clipboard.
.IP [33]
Control-z undoes the last edit action if the \fB\-undo\fR option is true.
Does nothing otherwise.
.IP [34]
Control-Z (or Control-y on Windows) reapplies the last undone edit action if
the \fB\-undo\fR option is true. Does nothing otherwise.
.PP
If the widget is disabled using the \fB\-state\fR option, then its view can
still be adjusted and text can still be selected, but no insertion cursor will
be displayed and no text modifications will take place.
.PP

Changes to doc/ttk_entry.n.

436
437
438
439
440
441
442



443
444
445
446
447
448
449
If there is no selection, it deletes the character to the left of
the insert cursor.
.IP \0\(bu 4
Control-d deletes the character to the right of the insert cursor.
.IP \0\(bu 4
Control-k deletes all the characters to the right of the insertion
cursor.



.SH "WIDGET STATES"
.PP
In the \fBdisabled\fR state,
the entry cannot be edited and the text cannot be selected.
In the \fBreadonly\fR state,
no insert cursor is displayed and
the entry cannot be edited







>
>
>







436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
If there is no selection, it deletes the character to the left of
the insert cursor.
.IP \0\(bu 4
Control-d deletes the character to the right of the insert cursor.
.IP \0\(bu 4
Control-k deletes all the characters to the right of the insertion
cursor.
.IP \0\(bu 4
Control-u deletes all the characters to the left of the insertion
cursor.
.SH "WIDGET STATES"
.PP
In the \fBdisabled\fR state,
the entry cannot be edited and the text cannot be selected.
In the \fBreadonly\fR state,
no insert cursor is displayed and
the entry cannot be edited

Changes to library/entry.tcl.

241
242
243
244
245
246
247





248
249
250
251
252
253
254
	%W delete insert end
    }
}
bind Entry <Control-t> {
    if {!$tk_strictMotif} {
	tk::EntryTranspose %W
    }





}
bind Entry <Meta-b> {
    if {!$tk_strictMotif} {
	tk::EntrySetCursor %W [tk::EntryPreviousWord %W insert]
    }
}
bind Entry <Meta-d> {







>
>
>
>
>







241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
	%W delete insert end
    }
}
bind Entry <Control-t> {
    if {!$tk_strictMotif} {
	tk::EntryTranspose %W
    }
}
bind Entry <Control-u> {
    if {!$tk_strictMotif} {
	%W delete 0 insert
    }
}
bind Entry <Meta-b> {
    if {!$tk_strictMotif} {
	tk::EntrySetCursor %W [tk::EntryPreviousWord %W insert]
    }
}
bind Entry <Meta-d> {

Changes to library/spinbox.tcl.

247
248
249
250
251
252
253





254
255
256
257
258
259
260
	%W delete insert end
    }
}
bind Spinbox <Control-t> {
    if {!$tk_strictMotif} {
	::tk::EntryTranspose %W
    }





}
bind Spinbox <Meta-b> {
    if {!$tk_strictMotif} {
	::tk::EntrySetCursor %W [::tk::EntryPreviousWord %W insert]
    }
}
bind Spinbox <Meta-d> {







>
>
>
>
>







247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
	%W delete insert end
    }
}
bind Spinbox <Control-t> {
    if {!$tk_strictMotif} {
	::tk::EntryTranspose %W
    }
}
bind Spinbox <Control-u> {
    if {!$tk_strictMotif} {
	%W delete 0 insert
    }
}
bind Spinbox <Meta-b> {
    if {!$tk_strictMotif} {
	::tk::EntrySetCursor %W [::tk::EntryPreviousWord %W insert]
    }
}
bind Spinbox <Meta-d> {

Changes to library/text.tcl.

329
330
331
332
333
334
335










336
337
338
339
340
341
342
	%W mark set insert insert-1c
    }
}
bind Text <Control-t> {
    if {!$tk_strictMotif} {
	tk::TextTranspose %W
    }










}

bind Text <<Undo>> {
    # An Undo operation may remove the separator at the top of the Undo stack.
    # Then the item at the top of the stack gets merged with the subsequent changes.
    # Place separators before and after Undo to prevent this.
    if {[%W cget -autoseparators]} {







>
>
>
>
>
>
>
>
>
>







329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
	%W mark set insert insert-1c
    }
}
bind Text <Control-t> {
    if {!$tk_strictMotif} {
	tk::TextTranspose %W
    }
}
bind Text <Control-u> {
    if {!$tk_strictMotif && [%W compare insert != 1.0]} {
	if {[%W compare insert == {insert linestart}]} {
	    %W delete insert-1c
	    %W see insert
	} else {
	    %W delete {insert linestart} insert
	}
    }
}

bind Text <<Undo>> {
    # An Undo operation may remove the separator at the top of the Undo stack.
    # Then the item at the top of the stack gets merged with the subsequent changes.
    # Place separators before and after Undo to prevent this.
    if {[%W cget -autoseparators]} {

Changes to library/ttk/entry.tcl.

140
141
142
143
144
145
146

147
148
149
150
151
152
153
bind TEntry <<NextLine>>		{# nothing}

## Additional emacs-like bindings:
#
bind TEntry <Control-Key-d>		{ ttk::entry::Delete %W }
bind TEntry <Control-Key-h>		{ ttk::entry::Backspace %W }
bind TEntry <Control-Key-k>		{ %W delete insert end }


### Clipboard procedures.
#

## EntrySelection -- Return the selected text of the entry.
#	Raises an error if there is no selection.
#







>







140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
bind TEntry <<NextLine>>		{# nothing}

## Additional emacs-like bindings:
#
bind TEntry <Control-Key-d>		{ ttk::entry::Delete %W }
bind TEntry <Control-Key-h>		{ ttk::entry::Backspace %W }
bind TEntry <Control-Key-k>		{ %W delete insert end }
bind TEntry <Control-Key-u>		{ %W delete 0 insert }

### Clipboard procedures.
#

## EntrySelection -- Return the selected text of the entry.
#	Raises an error if there is no selection.
#