Skip Menu |

This queue is for tickets about the Curses-UI-Grid CPAN distribution.

Report information
The Basics
Id: 132698
Status: new
Priority: 0/
Queue: Curses-UI-Grid

People
Owner: Nobody in particular
Requestors: Matthew.Buchanan [...] Mercy.Net
Cc:
AdminCc:

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



Subject: KEY_UP may not trigger -onprevpage
Date: Sun, 24 May 2020 23:33:08 +0000
To: "bug-Curses-UI-Grid [...] rt.cpan.org" <bug-Curses-UI-Grid [...] rt.cpan.org>
From: "Buchanan, Matt" <Matthew.Buchanan [...] Mercy.Net>
Hello, After applying the fixes suggested in bug #132696 so Grid.pm will display the last element of @data, KEY_UP will not trigger -onprevpage under these conditions: (1) (scalar @data) % $grid->page_size == 1; (2) the grid is displaying the last page; (3) the -onnextpage handler has hidden and marked un-focusable all but the first row on the page, as in grid-demo.pl. When all of these conditions are true, the last page will display the last row of @data, and when the user presses KEY_UP to move to the previous page, there is no response. KEY_PPAGE will still trigger -onprevpage from the last page, but KEY_UP will not. Grid::focus_obj() searches through all of the rows, and since only the current row is focusable, it ignores the request. The patch below short-circuits the search when $onprevpage or $onnextpage is set so focus_obj() can call the user's handlers to make more rows focusable. To reproduce the problem, make the changes suggested in bug #132696 and set the grid-demo.pl Browser demo's height to 14 or 10 or run the demo on a 24-line terminal so the grid's actual height is 18. With 49 elements in @data, this will leave one element to display on the last page. Navigate to the last page and press KEY_UP to move to the previous page. This error occurs on multiple Perl versions and operating systems: Curses-UI-Grid-0.15 Perl 5.24.4 on OpenBSD 6.4 Perl 5.30.2 on AIX 7.2.3.3 Thanks for your attention. M. B. Buchanan Mercy Technology Services diff -ur Grid.pm.orig Grid.pm --- Grid.pm.orig 2020-05-24 14:59:40.000000000 -0500 +++ Grid.pm 2020-05-24 15:23:48.000000000 -0500 @@ -1708,7 +1708,7 @@ my $test_obj = $this->{$map2id}{$this->{$collection}->[$idx]}; my $test_id = $test_obj->{-id}; - if($test_obj->focusable) { + if($test_obj->focusable || $onprevpage || $onnextpage) { $new_id = $test_id; $new_obj = $test_obj; last OBJECT This electronic mail and any attached documents are intended solely for the named addressee(s) and contain confidential information. If you are not an addressee, or responsible for delivering this email to an addressee, you have received this email in error and are notified that reading, copying, or disclosing this email is prohibited. If you received this email in error, immediately reply to the sender and delete the message completely from your computer system.

Message body is not shown because sender requested not to inline it.