Skip Menu |
 

This queue is for tickets about the Tk CPAN distribution.

Report information
The Basics
Id: 45599
Status: open
Priority: 0/
Queue: Tk

People
Owner: Nobody in particular
Requestors: KWittrock [...] web.de
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Problem with SelectionGet
Date: Thu, 30 Apr 2009 14:05:45 +0200
To: <bug-Tk [...] rt.cpan.org>
From: "K. Wittrock" <KWittrock [...] web.de>
Download (untitled) / with headers
text/plain 623b
I type ctrl-C to bring a multiline Text to the clipboard and then use $sel = $mainwindow->SelectionGet(-selection => 'CLIPBOARD'); to fetch it into my program. The retrieved Text is followed by some garbage characters. These consist of an ASCII NUL, followed by the last characters of the text. The number of garbage characters equals the number of newlines in the text. I can remedy this by adding $sel =~ s/\0.*//s; to my script, but I would prefer a solution within SelectionGet(). My software is Windows XP Home with SP3, ActivePerl version 5.8.8, and perl/Tk version 804.027. Kind regards Klaus Wittrock
Download (untitled) / with headers
text/plain 192b
here is a patch against subversion C:\devel\Tk\pTk\mTk\win\tkWinClipboard.c Seems to work here (Strawbwerry) - all tests pass. Could anybody review and confirm? Cheers, Christoph Lamprecht
Index: tkWinClipboard.c =================================================================== --- tkWinClipboard.c (revision 12718) +++ tkWinClipboard.c (working copy) @@ -146,23 +146,28 @@ /* * Translate CR/LF to LF. */ - + + int string_length = 0; + data = destPtr = Tcl_DStringValue(&ds); while (*data) { if (data[0] == '\r' && data[1] == '\n') { data++; } else { *destPtr++ = *data++; + string_length ++; } } + + Tcl_DStringTrunc(&ds, string_length); + *destPtr = '\0'; /* * Pass the data off to the selection procedure. */ - result = (*proc)(clientData, interp, (long *) Tcl_DStringValue(&ds), - Tcl_DStringLength(&ds),8,target,tkwin); + Tcl_DStringLength(&ds),8,target,tkwin); Tcl_DStringFree(&ds); CloseClipboard(); return result;
Subject: Re: [rt.cpan.org #45599] Problem with SelectionGet
Date: Fri, 15 May 2009 16:52:15 +0200
To: <bug-Tk [...] rt.cpan.org>
From: "K. Wittrock" <KWittrock [...] web.de>
Download (untitled) / with headers
text/plain 572b
Hello Christoph, sorry, I don't have a C compiler. I really apologize. Greetings Klaus Show quoted text
----- Original Message ----- From: "Lamprecht Christoph via RT" <bug-Tk@rt.cpan.org> To: <KWittrock@web.de> Sent: Wednesday, May 13, 2009 12:12 PM Subject: [rt.cpan.org #45599] Problem with SelectionGet
> <URL: https://rt.cpan.org/Ticket/Display.html?id=45599 > > > here is a patch against subversion > > C:\devel\Tk\pTk\mTk\win\tkWinClipboard.c > > Seems to work here (Strawbwerry) - all tests pass. > Could anybody review and confirm? > > Cheers, Christoph Lamprecht >
Download (untitled) / with headers
text/plain 246b
On Fri May 15 11:12:02 2009, KWittrock@web.de wrote: Show quoted text
> Hello Christoph, > > sorry, I don't have a C compiler. I really apologize. > >
You can install Strawberry Perl for Windows. This one comes with a C compiler bundled. Regards, Slaven
Download (untitled) / with headers
text/plain 458b
On Wed May 13 06:12:44 2009, LAMPRECHT wrote: Show quoted text
> here is a patch against subversion > > C:\devel\Tk\pTk\mTk\win\tkWinClipboard.c > > Seems to work here (Strawbwerry) - all tests pass. > Could anybody review and confirm? > > Cheers, Christoph Lamprecht
Klaus or Christoph, can you describe exactly how to reproduce the problem? I just tried it on a Windows XP system, with Strawberry Perl and Tk 804.028_502, but cannot reproduce it. Regards, Slaven
Subject: Re: [rt.cpan.org #45599] Problem with SelectionGet
Date: Fri, 05 Feb 2010 14:53:50 +0100
To: bug-Tk [...] rt.cpan.org
From: "K. Wittrock" <KWittrock [...] web.de>
Download (untitled) / with headers
text/plain 932b
Slaven_Rezic via RT schrieb: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=45599 > > > On Wed May 13 06:12:44 2009, LAMPRECHT wrote:
>> here is a patch against subversion >> >> C:\devel\Tk\pTk\mTk\win\tkWinClipboard.c >> >> Seems to work here (Strawbwerry) - all tests pass. >> Could anybody review and confirm? >> >> Cheers, Christoph Lamprecht
> > Klaus or Christoph, can you describe exactly how to reproduce the > problem? I just tried it on a Windows XP system, with Strawberry Perl > and Tk 804.028_502, but cannot reproduce it.
Please find attached a small test program. For best results, I suggest that you use a text with several short lines (gives much garbage), followed by a long line (gives a nearly correct newline count in the test, due to few newlines in the garbage). Usage: put the text to the clipboard, then start the test script. For obvious reasons, this error doesn't exist on Linux. HTH Klaus
Download selget.pl
text/x-perl 536b
use strict; use Tk; my $mw = MainWindow->new; my $sel = $mw->SelectionGet(-selection => 'CLIPBOARD'); #=for test print "No. of Newlines (incl. those in the garbage) ", $sel =~ tr/\n/\n/, "\n"; print "\nContents of selection +$sel+\n"; printf "Contents in hex:\n%v.2x\n", $sel; # Remove garbage at end $sel =~ s/\0.*//s; print "\n", 'Now removed garbage at end by $sel =~ s/\0.*//s;', "\n"; #=for test print "\nContents of selection +$sel+\n"; printf "Contents in hex:\n%v.2x\n", $sel; =cut MainLoop;


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.