Closed TakamotoAI closed 2 years ago
I think the problem derives from this
$w->clipboardGet;
which is called in module Tcl::pTk::Clipboard. With 6.9.11, it seems that the characters ’ is passed in a way that makes it break. You can test it overriding the paste action as here.
my $t = $mw->Scrolled('Text', -width => 40, -height => 10, -wrap => 'char', -bd => '1', -scrollbars => 'e')->pack(-expand => 1, -fill => 'both', -pady => 2, -padx => [2,0]);
$t->Subwidget('scrolled')->bind('Text','<<Paste>>', \&paste);
sub paste{
my $data = $t->clipboardGet;
}
PS: this issue does not happen with 6.9.10
To add something to the picture. It gives a segmentation error even with pure Tcl code inside a Eval
my $t = $mw->Scrolled('Text', -width => 40, -height => 10, -wrap => 'char', -bd => '1', -scrollbars => 'e')->pack(-expand => 1, -fill => 'both', -pady => 2, -padx => [2,0]);
$t->Subwidget('scrolled')->bind('Text','<<Paste>>', \&paste);
sub paste{
my $int = $mw->interp;
$int->Eval(<<'EOS');
set myVar [clipboard get]
EOS
}
Interesting enough, it does not crash with Entry widgets, which for me it makes even more obscure to understand. Looks like the Entry widget has a different way to get the Pasteboard?
I have reproduced this using Tcl syntax; see upstream ticket. This is likely not something to address from Tcl::pTk, but very good that this issue was spotted and reported.
This should be fixed in Tcl/Tk 8.6.12.
Posted also here https://core.tcl-lang.org/tk/tktview?name=234ee4f83b since I thought it was a pure Tcl/Tk issue. More experimenting seems to point now to a tcl::pTk issue (but still unsure). I am using 6.9.11 compiled as Frameworks.
The application crashes with Segmentation fault: 11 on macOS (tested on Mojave and bigSur) when pasting text with special characters from any different application (example: La réalisation d’une ouverture). This does not happen if typed directly or copied and pasted from the same Tk application.
In Perl, it can reproduced with the following:
I can not reproduce it a simple Text widget in Wish.
The incriminated character is this special apostrophe ’