Skip Menu |

This queue is for tickets about the Term-Screen-Win32 CPAN distribution.

Report information
The Basics
Id: 133670
Status: new
Priority: 0/
Queue: Term-Screen-Win32

People
Owner: tpaba [...] cpan.org
Requestors: jpierce [...] cpan.org
Cc:
AdminCc:

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



Subject: Patch at for performance
The attached patch bypasses calls to Cursor() when x or y parameters to at() are omitted, and emits a single sequence to reposition the cursor when both are supplied; instead of separate calls for x and y.
Subject: Win32.patch
--- Win32.pm~ 2006-03-28 09:45:44.000000000 -0500 +++ Win32.pm 2020-11-03 16:49:08.868875700 -0500 @@ -21,10 +21,12 @@ { my $key = lc($_[1]); - if ($key eq 'c') - { printf("\e[%d;%dH", (Win32::Console::ANSI::Cursor())[1], $_[2]+1); } + if ($key eq 'rc') + { printf("\e[%d;%dH", $_[2]->[0]+1, $_[2]->[1]+1); } + elsif ($key eq 'c') + { printf("\e[%d;%dH", 0, $_[2]+1); } elsif ($key eq 'r') - { printf("\e[%d;%dH", $_[2]+1, (Win32::Console::ANSI::Cursor())[0]); } + { printf("\e[%d;%dH", $_[2]+1, 0); } elsif ($key eq 'cols') { if (!Win32::Console::ANSI::SetConsoleSize($_[2], (Win32::Console::ANSI::XYMax())[1])) @@ -102,9 +104,10 @@ { return $_[0]->{'cols'}; }; sub at - { - if (defined($_[1])) { $_[0]->{'r'} = $_[1]; }; - if (defined($_[2])) { $_[0]->{'c'} = $_[2]; }; +{ + if (defined($_[1]) && defined($_[2]) ) { $_[0]->{'rc'} = [$_[1], $_[2]]; } + elsif (defined($_[1])) { $_[0]->{'r'} = $_[1]; } + elsif (defined($_[2])) { $_[0]->{'c'} = $_[2]; } return $_[0]; };