Hello community,

here is the log from the commit of package rofi-calc for openSUSE:Factory 
checked in at 2019-04-03 09:28:02
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rofi-calc (Old)
 and      /work/SRC/openSUSE:Factory/.rofi-calc.new.25356 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "rofi-calc"

Wed Apr  3 09:28:02 2019 rev:4 rq:690622 version:1.3

Changes:
--------
--- /work/SRC/openSUSE:Factory/rofi-calc/rofi-calc.changes      2019-04-01 
12:40:46.993985051 +0200
+++ /work/SRC/openSUSE:Factory/.rofi-calc.new.25356/rofi-calc.changes   
2019-04-03 09:28:03.711816562 +0200
@@ -1,0 +2,7 @@
+Tue Apr  2 10:38:44 UTC 2019 - [email protected]
+
+- Update to 1.3:
+  * Add -no-bold flag to disable bold results
+  * Implement -terse option
+
+-------------------------------------------------------------------

Old:
----
  v1.1.tar.gz

New:
----
  v1.3.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ rofi-calc.spec ++++++
--- /var/tmp/diff_new_pack.6Obbk4/_old  2019-04-03 09:28:04.471816920 +0200
+++ /var/tmp/diff_new_pack.6Obbk4/_new  2019-04-03 09:28:04.471816920 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           rofi-calc
-Version:        1.1
+Version:        1.3
 Release:        0
 Summary:        Calculator for rofi
 License:        MIT

++++++ v1.1.tar.gz -> v1.3.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/rofi-calc-1.1/README.md new/rofi-calc-1.3/README.md
--- old/rofi-calc-1.1/README.md 2019-03-30 21:54:07.000000000 +0100
+++ new/rofi-calc-1.3/README.md 2019-04-02 00:36:35.000000000 +0200
@@ -18,6 +18,8 @@
 
 The result of the current input can be selected with `Ctrl+Enter`, and history 
entries can be selected with `Enter`. By default this will just output the 
equation/result.
 
+Use the `-terse` option to reduce the output of `qalc` to just the result of 
the input expression.
+
 Use the `-calc-command` option to specify a shell command to execute which 
will be interpolated with the following keys:
 
 * `{expression}`: the left-side of the equation
@@ -31,6 +33,10 @@
 
     bindsym $mod+c exec --no-startup-id "rofi -show calc -modi calc 
-no-show-match -no-sort"
 
+To disable the bold font applied to the results by default, you can use the 
flag `-no-bold` and run rofi like:
+
+    rofi -show calc -modi calc -no-show-match -no-sort -no-bold
+
 ## Compilation
 
 ### Dependencies
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/rofi-calc-1.1/src/calc.c new/rofi-calc-1.3/src/calc.c
--- old/rofi-calc-1.1/src/calc.c        2019-03-30 21:54:07.000000000 +0100
+++ new/rofi-calc-1.3/src/calc.c        2019-04-02 00:36:35.000000000 +0200
@@ -65,6 +65,18 @@
 
 
 /**
+ * Option to disable bold results
+ */
+#define NO_BOLD_OPTION "-no-bold"
+
+
+/**
+ * Terse option
+ */
+#define TERSE_OPTION "-terse"
+
+
+/**
  * The following keys can be specified in `CALC_COMMAND_FLAG` and
  * will be replaced with the left-hand side and right-hand side of
  * the equation.
@@ -137,7 +149,6 @@
 // character.
 static char** split_equation(char* string)
 {
-    int index = 0;
     int parens_depth = 0;
     char* curr = string;
 
@@ -304,8 +315,19 @@
     GError *error = NULL;
     CALCModePrivateData* pd = (CALCModePrivateData*)mode_get_private_data(sw);
 
-    const gchar* const argv[] = { "qalc", "+u8", "-s", "update_exchange_rates 
1days", input, NULL };
-    GSubprocess* process = g_subprocess_newv(argv, 
G_SUBPROCESS_FLAGS_STDOUT_PIPE | G_SUBPROCESS_FLAGS_STDERR_MERGE, &error);
+    GPtrArray *argv = g_ptr_array_new();
+    g_ptr_array_add(argv, "qalc");
+    g_ptr_array_add(argv, "+u8");
+    g_ptr_array_add(argv, "-s");
+    g_ptr_array_add(argv, "update_exchange_rates 1days");
+    if (find_arg(TERSE_OPTION) > -1) {
+        g_ptr_array_add(argv, "-t");
+    }
+    g_ptr_array_add(argv, (gchar*)input);
+    g_ptr_array_add(argv, NULL);
+
+    GSubprocess* process = g_subprocess_newv((const gchar**)(argv->pdata), 
G_SUBPROCESS_FLAGS_STDOUT_PIPE | G_SUBPROCESS_FLAGS_STDERR_MERGE, &error);
+    g_ptr_array_free(argv, TRUE);
 
     if (error != NULL) {
         g_error("Spawning child failed: %s", error->message);
@@ -323,7 +345,10 @@
     if (is_error_string(pd->last_result)) {
         return g_markup_printf_escaped("<span 
foreground='PaleVioletRed'>%s</span>", pd->last_result);
     }
-    return g_markup_printf_escaped("Result: <b>%s</b>", pd->last_result);
+    if (find_arg(NO_BOLD_OPTION) == -1)
+        return g_markup_printf_escaped("Result: <b>%s</b>", pd->last_result);
+    else
+        return g_markup_printf_escaped("Result: %s", pd->last_result);
 }
 
 Mode mode =


Reply via email to