[gnome-calculator/gnome-3-32] search-provider: stop normalizing the equation twice



commit 07a5442cb6c508e455fbe0774a2094257c73211e
Author: Pascal Nowack <Pascal Nowack gmx de>
Date:   Sun Mar 31 14:11:16 2019 +0200

    search-provider: stop normalizing the equation twice
    
    When an equation is given by the g-s overview, g-c
    will solve this equation, where it will be first
    normalized and then solved.
    This is done by running a subprocess, where g-c
    will call g-c in this subprocess with the
    "--solve" argument.
    With this "--solve" argument, the equation will
    also be normalized.
    However, when an equation is given by the g-s
    overview, it will also be normalized in a check,
    that happens before the solve process, to not to
    process single numbers given by the g-s overview.
    This normalized equation will then be used to
    invoke the subprocess to solve the equation,
    leading into normalizing the already normalized
    equation and therefore resulting into wrong
    results when the equation itself contains
    decimal numbers.
    
    Solve this issue, by invoking the subprocess with
    the unnormalized equation, instead of the
    normalized one, to not to normalize the
    equation twice.
    
    Closes: https://gitlab.gnome.org/GNOME/gnome-calculator/issues/104

 search-provider/search-provider.vala | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/search-provider/search-provider.vala b/search-provider/search-provider.vala
index 6c786326..7aa5f44f 100644
--- a/search-provider/search-provider.vala
+++ b/search-provider/search-provider.vala
@@ -108,7 +108,7 @@ public class SearchProvider : Object
 
         try
         {
-            var subprocess = yield solve_subprocess (normalized_equation);
+            var subprocess = yield solve_subprocess (equation);
             yield subprocess.communicate_utf8_async (null, cancellable, out result, null);
             subprocess.wait_check (cancellable);
         }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]