Tk Library Source Code

View Ticket
Login
Ticket UUID: 392557a16f62bc33cb74eebc071e82afca61dc20
Title: widgetPlus: undo/redo bugs found by the new tests
Type: Bug Version: trunk
Submitter: serhiy.storchaka Created on: 2026-11-21 18:08:48
Subsystem: None Assigned To: nobody
Priority: 5 Medium Severity: Minor
Status: Open Last Modified: 2026-11-21 18:08:48
Resolution: None Closed By: nobody
    Closed on:
Description:

The bugs below were found by the tests in branch tests-widgetPlus; each is covered by a test with the knownBug constraint (widgetPlus-10.14.*, 10.23.*, 10.24.*, 10.25.* and 10.26.2; the suffixes .1 to .5 are for entryPlus, spinboxPlus, ttkEntryPlus, ttkSpinboxPlus and ttkComboboxPlus). All of them occur for all five widgets, with Tk 8.6 and 9.1.

  • Undo and redo replace the text with delete 0 end followed by insert, and both are validated. If -validatecommand rejects the intermediate empty text, the old text is not deleted, and undo produces a text that never existed. With -validate key -validatecommand {expr {[string length %P] > 0}}, after inserting "a" and then "b", edit undo gives "aab" instead of "a", and edit redo then gives "abaab" instead of "ab". (widgetPlus-10.14.*)
  • .wp configure -textvariable {} pushes an empty text on the undo stack although the text does not change: after edit reset, edit canundo returns 1, edit undo has no visible effect, and edit redo clears the widget. (widgetPlus-10.23.*)
  • The undo stack of a new widget starts with an empty text, and the initial value of the -textvariable is pushed on it as an edit: for set wpVar abc; widgetPlus::entryPlus .wp -textvariable wpVar, edit canundo and edit modified return 1, and the initial value can be "undone" to an empty text. (widgetPlus-10.24.*)
  • When an existing widget with text is converted (e.g. entry .wp; .wp insert end hello; widgetPlus::entryPlus .wp), the undo stack starts with an empty text instead of the existing text, so after an edit the first undo empties the widget instead of restoring "hello". The same happens with the initial value of a spinbox: for widgetPlus::spinboxPlus .wp -from 1 -to 5, undo after .wp invoke buttonup gives an empty text instead of "1". (widgetPlus-10.25.*, 10.26.2)