Skip Menu |
 

This queue is for tickets about the Tk CPAN distribution.

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

People
Owner: Nobody in particular
Requestors: alohadw1 [...] yahoo.com
Cc: CAC [...] cpan.org
AdminCc:

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



Subject: scrolled text widget hangs
Date: Fri, 6 May 2016 06:33:41 +0000 (UTC)
To: "bug-Tk [...] rt.cpan.org" <bug-Tk [...] rt.cpan.org>
From: David Walsh <alohadw1 [...] yahoo.com>
I've noticed what appears to be a bug in the perl Tk scrolled text widget that causes it to hang when large amounts of text are selected by dragging with the mouse.  The problem seems to be due to the interaction between the mouse selection event and the horizontal scrollbar, which appears and disappears during text selection, depending on the length of the text lines being selected.  I wrote the short script below to illustrate the problem in the simplest way I could - documentation inside the script may help illustrate the issue better.  I'm running ubuntu 14.04.4, perl 5.18.2, and perl-Tk-804.033.  Thanks for looking into this.  Regards, David Walsh #!/usr/bin/perl # # script to illustrate dysfunctional interaction between horizontal scrollbar # in scrolled text widget when selecting large amounts of text by dragging with # mouse B1.  The problem is not entirely predictable, but seems to happen when # the horizontal scrollbar appears and disappears several times while large amounts # of text are being selected by dragging the mouse.  Occurrence depends on horizontal # dimension of the widget relative to line length, and does not seem to occur if the # widget is either "too narrow" or "too wide".  It seems to occur most often when the # width of the widget is slightly less than the max line length, so that the horizontal # scroll bar appears and disappears many times while large amounts of text are being # selected.  The only work-around I have come up with for this is to make the horizontal # scrollbar "non-automatic" (i.e. so it's always there), or to eliminate it entirely.  # Once the problem occurs the only solution is to re-start the widget. use Tk; require Tk::ROText; $mw  = MainWindow->new(-title=>"TEST"); $mw->geometry("1100x600"); $mw->resizable(0,0); $NLINES = 2500; $frame = $mw->Labelframe(-font=>['Courier','14','normal'],-borderwidth=>2) -> pack(-fill=>"both", -side=>"top", -expand=>"true"); # the following line creates 'automatic' scrollbars at the bottom of the widget and # at the right, which appear automatically when text width/height exceeds widget # dimension $mssg_text = $frame->Scrolled('ROText',-font=>['Courier','14'],-background=>"wheat",-scrollbars=>"osoe",-foreground=>"black",-wrap=>"none") -> pack(-fill=>"both", -side=>"top", -expand=>"true"); # in the following line the horizontal scrollbar has been disabled #$mssg_text = $frame->Scrolled('ROText',-font=>['Courier','14'],-background=>"wheat",-scrollbars=>"oe",-foreground=>"black",-wrap=>"none") -> pack(-fill=>"both", -side=>"top", -expand=>"true"); &FillTextWidget(); MainLoop; #---------------------------------------- sub FillTextWidget { # fill text widget with random-length lines     for ($knt1=1;$knt1<$NLINES;$knt1++) {       $line = $knt1 . " TEST";         $randomNumber = int(rand(20));         for ($knt2=0;$knt2<$randomNumber;$knt2++) {         $line = $line . " TEST";         }         $line = $line . "\n";         $mssg_text->insert('end',"$line");     } }
Download (untitled) / with headers
text/plain 3.7k
On 2016-05-06 02:40:25, alohadw1@yahoo.com wrote: Show quoted text
> I've noticed what appears to be a bug in the perl Tk scrolled text > widget that causes it to hang when large amounts of text are selected > by dragging with the mouse.  The problem seems to be due to the > interaction between the mouse selection event and the horizontal > scrollbar, which appears and disappears during text selection, > depending on the length of the text lines being selected.  I wrote the > short script below to illustrate the problem in the simplest way I > could - documentation inside the script may help illustrate the issue > better.  I'm running ubuntu 14.04.4, perl 5.18.2, and perl-Tk- > 804.033.  Thanks for looking into this.  Regards, David Walsh
Yes, that's a known problem, for quite a long time. A similar issue exists at the github issue tracker: https://github.com/eserte/perl-tk/issues/22 The only known workaround is to omit one of the two "o" in the scrollbars specification, so "ose" or "soe" should work. I don't have ideas for a "real" solution. A possible hack would be to check the time between addition and removal of scrollbars and turn off optional scrollbars if this time is too short. Probably there should also be an entry in the Pod of Tk::Scrolled. Regards, Slaven Show quoted text
> #!/usr/bin/perl > # > # script to illustrate dysfunctional interaction between horizontal > scrollbar > # in scrolled text widget when selecting large amounts of text by > dragging with > # mouse B1.  The problem is not entirely predictable, but seems to > happen when > # the horizontal scrollbar appears and disappears several times while > large amounts > # of text are being selected by dragging the mouse.  Occurrence > depends on horizontal > # dimension of the widget relative to line length, and does not seem > to occur if the > # widget is either "too narrow" or "too wide".  It seems to occur > most often when the > # width of the widget is slightly less than the max line length, so > that the horizontal > # scroll bar appears and disappears many times while large amounts of > text are being > # selected.  The only work-around I have come up with for this is to > make the horizontal > # scrollbar "non-automatic" (i.e. so it's always there), or to > eliminate it entirely. > # Once the problem occurs the only solution is to re-start the widget. > > use Tk; > require Tk::ROText; > > $mw  = MainWindow->new(-title=>"TEST"); > $mw->geometry("1100x600"); > $mw->resizable(0,0); > > $NLINES = 2500; > > $frame = $mw->Labelframe(-font=>['Courier','14','normal'],- > borderwidth=>2) -> pack(-fill=>"both", -side=>"top", -expand=>"true"); > > # the following line creates 'automatic' scrollbars at the bottom of > the widget and > # at the right, which appear automatically when text width/height > exceeds widget > # dimension > $mssg_text = $frame->Scrolled('ROText',-font=>['Courier','14'],- > background=>"wheat",-scrollbars=>"osoe",-foreground=>"black",- > wrap=>"none") -> pack(-fill=>"both", -side=>"top", -expand=>"true"); > > # in the following line the horizontal scrollbar has been disabled > #$mssg_text = $frame->Scrolled('ROText',-font=>['Courier','14'],- > background=>"wheat",-scrollbars=>"oe",-foreground=>"black",- > wrap=>"none") -> pack(-fill=>"both", -side=>"top", -expand=>"true"); > > &FillTextWidget(); > > MainLoop; > > #---------------------------------------- > > sub FillTextWidget { > > # fill text widget with random-length lines > >     for ($knt1=1;$knt1<$NLINES;$knt1++) { >       $line = $knt1 . " TEST"; >         $randomNumber = int(rand(20)); >         for ($knt2=0;$knt2<$randomNumber;$knt2++) { >         $line = $line . " TEST"; >         } >         $line = $line . "\n"; >         $mssg_text->insert('end',"$line"); >     } > > }
Subject: Re: [rt.cpan.org #114203] scrolled text widget hangs
Date: Mon, 30 May 2016 21:56:59 +0000 (UTC)
To: "bug-Tk [...] rt.cpan.org" <bug-Tk [...] rt.cpan.org>
From: David Walsh <alohadw1 [...] yahoo.com>
Download (untitled) / with headers
text/plain 4.6k
Hi Slaven, Thanks for getting back to me.  Pending a "real" solution, it seems it might be best to make "osoe" an illegal scrollbar specification, which would cause a script to fail immediately with some sort of descriptive error message (or at least issue a warning).  That could save future users like me a lot of head-scratching time spent re-discovering an old bug.  Also, as you probably know, the bug can have pretty severe consequences - it brought our RHEL servers to near-standstill.  Given that, it seems like a good idea to prevent it happening via, e.g., some simple change like that suggested above.  Thanks for your work on perl-Tk.  David PS, What is the status of perl-Tk in perl6 - will it be available in the foreseeable future? On Sunday, May 15, 2016 2:47 AM, Slaven_Rezic via RT <bug-Tk@rt.cpan.org> wrote: <URL: https://rt.cpan.org/Ticket/Display.html?id=114203 > On 2016-05-06 02:40:25, alohadw1@yahoo.com wrote: Show quoted text
> I've noticed what appears to be a bug in the perl Tk scrolled text > widget that causes it to hang when large amounts of text are selected > by dragging with the mouse.  The problem seems to be due to the > interaction between the mouse selection event and the horizontal > scrollbar, which appears and disappears during text selection, > depending on the length of the text lines being selected.  I wrote the > short script below to illustrate the problem in the simplest way I > could - documentation inside the script may help illustrate the issue > better.  I'm running ubuntu 14.04.4, perl 5.18.2, and perl-Tk- > 804.033.  Thanks for looking into this.  Regards, David Walsh
Yes, that's a known problem, for quite a long time. A similar issue exists at the github issue tracker: https://github.com/eserte/perl-tk/issues/22 The only known workaround is to omit one of the two "o" in the scrollbars specification, so "ose" or "soe" should work. I don't have ideas for a "real" solution. A possible hack would be to check the time between addition and removal of scrollbars and turn off optional scrollbars if this time is too short. Probably there should also be an entry in the Pod of Tk::Scrolled. Regards,     Slaven Show quoted text
> #!/usr/bin/perl > # >  # script to illustrate dysfunctional interaction between horizontal > scrollbar >  # in scrolled text widget when selecting large amounts of text by > dragging with >  # mouse B1.  The problem is not entirely predictable, but seems to > happen when >  # the horizontal scrollbar appears and disappears several times while > large amounts >  # of text are being selected by dragging the mouse.  Occurrence > depends on horizontal >  # dimension of the widget relative to line length, and does not seem > to occur if the >  # widget is either "too narrow" or "too wide".  It seems to occur > most often when the > # width of the widget is slightly less than the max line length, so > that the horizontal >  # scroll bar appears and disappears many times while large amounts of > text are being >  # selected.  The only work-around I have come up with for this is to > make the horizontal >  # scrollbar "non-automatic" (i.e. so it's always there), or to > eliminate it entirely. > # Once the problem occurs the only solution is to re-start the widget. > > use Tk; > require Tk::ROText; > > $mw  = MainWindow->new(-title=>"TEST"); > $mw->geometry("1100x600"); > $mw->resizable(0,0); > > $NLINES = 2500; > > $frame = $mw->Labelframe(-font=>['Courier','14','normal'],- > borderwidth=>2) -> pack(-fill=>"both", -side=>"top", -expand=>"true"); > > # the following line creates 'automatic' scrollbars at the bottom of > the widget and > # at the right, which appear automatically when text width/height > exceeds widget > # dimension > $mssg_text = $frame->Scrolled('ROText',-font=>['Courier','14'],- > background=>"wheat",-scrollbars=>"osoe",-foreground=>"black",- > wrap=>"none") -> pack(-fill=>"both", -side=>"top", -expand=>"true"); > > # in the following line the horizontal scrollbar has been disabled > #$mssg_text = $frame->Scrolled('ROText',-font=>['Courier','14'],- > background=>"wheat",-scrollbars=>"oe",-foreground=>"black",- > wrap=>"none") -> pack(-fill=>"both", -side=>"top", -expand=>"true"); > > &FillTextWidget(); > > MainLoop; > > #---------------------------------------- > > sub FillTextWidget { > > # fill text widget with random-length lines > >     for ($knt1=1;$knt1<$NLINES;$knt1++) { >       $line = $knt1 . " TEST"; >         $randomNumber = int(rand(20)); >         for ($knt2=0;$knt2<$randomNumber;$knt2++) { >         $line = $line . " TEST"; >         } >         $line = $line . "\n"; >         $mssg_text->insert('end',"$line"); >     } > > }


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.