Skip to content

Commit

Permalink
Fix bug when not converting negative frac
Browse files Browse the repository at this point in the history
  • Loading branch information
windymilla committed Jun 7, 2024
1 parent d3c9e02 commit c96613f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/lib/Guiguts/CharacterTools.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1188,11 +1188,12 @@ sub fractionconvert {
$outfraction = "$numerator$fracslash$denominator";
}

# Add hyphen back if it's actually a minus sign for a negative fraction (not a hyphen in 1-3/4)
if ( substr( $infraction, 0, 1 ) eq '-' and $chbefore !~ /[0-9]/ ) {
$outfraction = '-' . $outfraction;
}
if ($outfraction) {

# Add hyphen back if it's actually a minus sign for a negative fraction (not a hyphen in 1-3/4)
if ( substr( $infraction, 0, 1 ) eq '-' and $chbefore !~ /[0-9]/ ) {
$outfraction = '-' . $outfraction;
}
my $advance = '+' . length($outfraction) . 'c';
$textwindow->insert( $start, $outfraction ); # insert first to avoid page marker slippage
$textwindow->delete( $start . $advance, $end . $advance );
Expand Down

0 comments on commit c96613f

Please sign in to comment.