From 65c1346e0fdace4caa4b1a6196704243a31ac8c3 Mon Sep 17 00:00:00 2001 From: Shlomi Fish Date: Mon, 12 Nov 2012 23:40:10 +0200 Subject: [PATCH] Extract _cmd_l_calc_initial_end_and_i . --- lib/perl5db.pl | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/lib/perl5db.pl b/lib/perl5db.pl index 9d77568..aa2ce8c 100644 --- a/lib/perl5db.pl +++ b/lib/perl5db.pl @@ -5575,8 +5575,15 @@ sub _cmd_l_plus { return cmd_l( 'l', $line ); } -sub _cmd_l_calc_initial_i { - my ($line, $start_match, $end) = @_; +sub _cmd_l_calc_initial_end_and_i { + my ($line, $start_match, $end_match) = @_; + + # Determine end point; use end of file if not specified. + my $end = ( !defined $start_match ) ? $max : + ( $end_match ? $end_match : $start_match ); + + # Go on to the end, and then stop. + _minify_to_max(\$end); # Determine start line. my $i = $start_match; @@ -5589,20 +5596,14 @@ sub _cmd_l_calc_initial_i { $incr = $end - $i; - return $i; + return ($end, $i); } sub _cmd_l_range { my ($cmd, $line, $current_line, $start_match, $end_match) = @_; - # Determine end point; use end of file if not specified. - my $end = ( !defined $start_match ) ? $max : - ( $end_match ? $end_match : $start_match ); - - # Go on to the end, and then stop. - _minify_to_max(\$end); - - my $i = _cmd_l_calc_initial_i($line, $start_match, $end); + my ($end, $i) = + _cmd_l_calc_initial_end_and_i($line, $start_match, $end_match); # If we're running under a slave editor, force it to show the lines. if ($slave_editor) { -- 2.7.4