Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package rofi-calc for openSUSE:Factory 
checked in at 2022-02-11 23:07:43
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rofi-calc (Old)
 and      /work/SRC/openSUSE:Factory/.rofi-calc.new.1956 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "rofi-calc"

Fri Feb 11 23:07:43 2022 rev:12 rq:953375 version:2.1.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/rofi-calc/rofi-calc.changes      2020-11-17 
21:24:16.977318143 +0100
+++ /work/SRC/openSUSE:Factory/.rofi-calc.new.1956/rofi-calc.changes    
2022-02-11 23:09:25.386948332 +0100
@@ -1,0 +2,8 @@
+Fri Feb 11 07:46:31 UTC 2022 - Michael Vetter <mvet...@suse.com>
+
+- Update to 2.1.0:
+  * Correctly handle ??? signs emitted by qalc #78
+  * Add -calc-command-history to add result to history when using 
-calc-command #79
+  * Correctly handle multiple equals signs emitted by qalc #80
+
+-------------------------------------------------------------------

Old:
----
  v2.0.0.tar.gz

New:
----
  v2.1.0.tar.gz

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

Other differences:
------------------
++++++ rofi-calc.spec ++++++
--- /var/tmp/diff_new_pack.xm7Ke5/_old  2022-02-11 23:09:25.862949708 +0100
+++ /var/tmp/diff_new_pack.xm7Ke5/_new  2022-02-11 23:09:25.870949732 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package rofi-calc
 #
-# Copyright (c) 2020 SUSE LLC
+# Copyright (c) 2022 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -17,7 +17,7 @@
 
 
 Name:           rofi-calc
-Version:        2.0.0
+Version:        2.1.0
 Release:        0
 Summary:        Calculator for rofi
 License:        MIT

++++++ v2.0.0.tar.gz -> v2.1.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/rofi-calc-2.0.0/CHANGELOG.md 
new/rofi-calc-2.1.0/CHANGELOG.md
--- old/rofi-calc-2.0.0/CHANGELOG.md    2020-11-14 12:19:57.000000000 +0100
+++ new/rofi-calc-2.1.0/CHANGELOG.md    2022-02-06 19:03:04.000000000 +0100
@@ -5,9 +5,14 @@
 The format is based on [Keep a Changelog](http://keepachangelog.com/)
 and this project adheres to [Semantic Versioning](http://semver.org/).
 
-<!-- next-header -->
-
 ## [Unreleased] - ReleaseDate
+
+## [2.0.1] - 2022-02-06
+- Correctly handle ??? signs emitted by qalc 
[#78](https://github.com/svenstaro/rofi-calc/pull/78) (thanks @SabrinaJewson)
+- Add `-calc-command-history` to add result to history when using 
`-calc-command` [#79](https://github.com/svenstaro/rofi-calc/pull/79) (thanks 
@SabrinaJewson)
+- Correctly handle multiple equals signs emitted by qalc 
[#80](https://github.com/svenstaro/rofi-calc/pull/78) (thanks @SabrinaJewson)
+
+## [2.0.0] - 2020-11-14
 - Add option to completely disable history 
[#63](https://github.com/svenstaro/rofi-calc/pull/63) (thanks @UnkwUsr)
 
 ## [1.9] - 2020-09-24
@@ -18,5 +23,6 @@
 - Add `-no-unicode` option to disable aforementioned unicode support
 
 <!-- next-url -->
-[Unreleased]: https://github.com/svenstaro/rofi-calc/compare/v1.9...HEAD
+[Unreleased]: https://github.com/svenstaro/rofi-calc/compare/v2.0.0...HEAD
+[2.0.0]: https://github.com/svenstaro/rofi-calc/compare/v1.9...v2.0.0
 [1.9]: https://github.com/svenstaro/rofi-calc/compare/v1.8...v1.9
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/rofi-calc-2.0.0/README.md 
new/rofi-calc-2.1.0/README.md
--- old/rofi-calc-2.0.0/README.md       2020-11-14 12:19:57.000000000 +0100
+++ new/rofi-calc-2.1.0/README.md       2022-02-06 19:03:04.000000000 +0100
@@ -75,6 +75,13 @@
 
         rofi -show calc -modi calc -no-show-match -no-sort -calc-command "echo 
-n '{result}' | xclip"
 
+    Alternatively, this example would immediately type out the result (using 
`xdotool`) wherever your cursor currently is
+    (upon pressing Control+Return/`-kb-accept-custom`):
+
+        rofi -modi calc -show calc -calc-command 'xdotool type 
--clearmodifiers "{result}"'
+
+- The `-calc-command-history` option will additionally add the output of 
`qalc` to history when the `-calc-command` is run.
+    This will have no effect if `-no-history` is enabled.
 - It's convenient to bind it to a key combination in i3. For instance, you 
could use:
 
         bindsym $mod+c exec --no-startup-id "rofi -show calc -modi calc 
-no-show-match -no-sort > /dev/null"
@@ -125,4 +132,9 @@
 
 If you're developing this, it might be helpful to start rofi directly with a 
locally compiled plugin like this:
 
-    rofi -plugin-path build/.libs -show calc -modi calc -no-show-match -no-sort
+    autoreconf -i
+    mkdir build
+    cd build
+    ../configure
+    make
+    rofi -plugin-path .libs -show calc -modi calc -no-show-match -no-sort
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/rofi-calc-2.0.0/src/calc.c 
new/rofi-calc-2.1.0/src/calc.c
--- old/rofi-calc-2.0.0/src/calc.c      2020-11-14 12:19:57.000000000 +0100
+++ new/rofi-calc-2.1.0/src/calc.c      2022-02-06 19:03:04.000000000 +0100
@@ -53,6 +53,7 @@
 #define PARENS_LEFT  '('
 #define PARENS_RIGHT ')'
 #define EQUALS_SIGN  '='
+#define APPROX_SIGN  "???"
 
 // qalc binary name
 #define QALC_BINARY_OPTION "-qalc-binary"
@@ -60,6 +61,9 @@
 // Calc command option
 #define CALC_COMMAND_OPTION "-calc-command"
 
+// Whether calc command emits a history entry
+#define CALC_COMMAND_USES_HISTORY "-calc-command-history"
+
 // Option to disable bold results
 #define NO_BOLD_OPTION "-no-bold"
 
@@ -332,28 +336,44 @@
     }
 
     int parens_depth = 0;
-    char* curr = string;
+    char* curr = string + strlen(string);
+    int delimiter_len = 0;
 
     // Iterate through and track our level of nestedness, stopping when
     // we've hit an equals sign not inside other parentheses.
     // At this point we can set the NULL character to split the string
-    // into `string` and `curr + 1`.
-    while (*curr) {
-        if (*curr == PARENS_LEFT) {
+    // into `string` and `curr + delimiter_len`.
+    while (curr != string) {
+        curr--;
+        if (*curr == PARENS_RIGHT) {
             parens_depth++;
-        } else if (*curr == PARENS_RIGHT) {
+        } else if (*curr == PARENS_LEFT) {
             parens_depth--;
-        } else if (*curr == EQUALS_SIGN && parens_depth == 0) {
-            break;
+        } else if (parens_depth == 0) {
+            if (*curr == EQUALS_SIGN) {
+                delimiter_len = 1;
+                break;
+            } else if (!strncmp(curr, APPROX_SIGN, strlen(APPROX_SIGN))) {
+                delimiter_len = strlen(APPROX_SIGN);
+                break;
+            }
         }
-        curr++;
     }
-    *curr = '\0';
 
-    // Strip trailing whitespace with `g_strchomp()` from the left.
-    // Strip leading whitespace with `g_strchug()` from the right.
-    result[0] = g_strchomp(string);
-    result[1] = g_strchug(curr + 1);
+    if (curr == string) {
+        // No equals signs were found. Shouldn't happen, but if it does treat
+        // the entire expression as the result.
+        result[0] = NULL;
+        result[1] = g_strdup(string);
+    } else {
+        // We found an equals sign; set it to null to split the string in two.
+        *curr = '\0';
+
+        // Strip trailing whitespace with `g_strchomp()` from the left.
+        // Strip leading whitespace with `g_strchug()` from the right.
+        result[0] = g_strchomp(string);
+        result[1] = g_strchug(curr + delimiter_len);
+    }
 
     return result;
 }
@@ -415,6 +435,14 @@
         retv = MODE_EXIT;
     } else if (menu_entry & MENU_CUSTOM_INPUT) {
         if (!is_error_string(pd->last_result) && strlen(pd->last_result) > 0) {
+            if (find_arg(NO_HISTORY_OPTION) == -1 && 
find_arg(CALC_COMMAND_USES_HISTORY) != -1) {
+                char* history_entry = g_strdup_printf("%s", pd->last_result);
+                g_ptr_array_add(pd->history, (gpointer) history_entry);
+                if (find_arg(NO_PERSIST_HISTORY_OPTION) == -1) {
+                    append_str_to_history(history_entry);
+                }
+            }
+
             execsh(pd->cmd, pd->last_result);
             retv = MODE_EXIT;
         } else {

Reply via email to