The issue is reported at the Ruby Tk GitHub project page (title: Tk::Text listening to a tag covering 1.0 to end stops working after clearing all text (on Mac)):
opened 10:08PM - 04 Nov 21 UTC
In light of the solution to https://github.com/ruby/tk/issues/36, I wrote code t… hat monitored key presses upon moving around a `Tk::Text` widget with the arrow keys. It basically registers a listener to `<KeyPress>` event on a pre-added tag that covers a range of index `1.0` to `end`.
Here is a code example of this:
```ruby
require 'tk'
@root = Tk::Root.new
@text = Tk::Text.new(@root).grid
@text.value = "Some giberish repeated many times\n"*20
@text.tag_add('all', '1.0', 'end')
@text.tag_bind('all', 'KeyPress', ->(event) {puts 'key press', event.inspect})
@root.mainloop
```
You can navigate around the `Tk::Text` widget using the arrow keys with no problem. It always fires the `<KeyPress>` listener anywhere in the `1.0` to `end` range, printing the event information.
Trouble starts once I clear all the text by highlighting with `CMD+A` and then hitting `DELETE`. Afterwards, when I type new text and then move the arrow keys around, no firing of the `<KeyPress>` event happens anymore.
The plot thickens however. If I insert enough new lines, it sometimes starts firing again, albeit temporarily, and then it stops again.
Either way, the functionality seems broken. It is probably broken in ActiveTcl, not in the Ruby code, but I thought I'd report here just in case there is an issue in the Ruby code.
How do I report it to ActiveState? I am an open-source user, not a commercial user. I would imagine it is still useful to ActiveState to learn about the issue.
Best regards,
Andy Maleh
JeffR
November 5, 2021, 8:21pm
2
Thanks Andy,
We’ll have a look here, not sure if it is ActiveTcl per se or upstream from us.
Cheers,
-JR
That’s definitely upstream. The Tcl Community runs many resources for discussing Tcl issues. There’s an active tag for Tcl in StackOverflow, and the front panel for the Tcl info site is found here:
http://www.tcl-lang.org/community/coreteam/
Bugs in Tk itself are reported, described, diagnosed, and tracked here:
https://core.tcl-lang.org/tk/ticket
1 Like
Thank you.
I reported over here: Tk Source Code: View Ticket
Best,
Andy Maleh
1 Like