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 2023-04-29 17:28:29
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rofi-calc (Old)
 and      /work/SRC/openSUSE:Factory/.rofi-calc.new.1533 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "rofi-calc"

Sat Apr 29 17:28:29 2023 rev:14 rq:1083618 version:2.2.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/rofi-calc/rofi-calc.changes      2022-11-06 
12:42:09.729367396 +0100
+++ /work/SRC/openSUSE:Factory/.rofi-calc.new.1533/rofi-calc.changes    
2023-04-29 17:28:35.838656909 +0200
@@ -1,0 +2,8 @@
+Sat Apr 29 08:15:57 UTC 2023 - Michael Vetter <mvet...@suse.com>
+
+- Update to 2.2.0:
+  * qcalc spawning behavior change
+  * Add --automatic-save-to-history option
+  * Fix memory leak from #66
+
+-------------------------------------------------------------------

Old:
----
  v2.1.0.tar.gz

New:
----
  v2.2.0.tar.gz

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

Other differences:
------------------
++++++ rofi-calc.spec ++++++
--- /var/tmp/diff_new_pack.0SPe5m/_old  2023-04-29 17:28:36.558659923 +0200
+++ /var/tmp/diff_new_pack.0SPe5m/_new  2023-04-29 17:28:36.566659957 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package rofi-calc
 #
-# Copyright (c) 2022 SUSE LLC
+# Copyright (c) 2023 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.1.0
+Version:        2.2.0
 Release:        0
 Summary:        Calculator for rofi
 License:        MIT

++++++ v2.1.0.tar.gz -> v2.2.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/rofi-calc-2.1.0/CHANGELOG.md 
new/rofi-calc-2.2.0/CHANGELOG.md
--- old/rofi-calc-2.1.0/CHANGELOG.md    2022-02-06 19:03:04.000000000 +0100
+++ new/rofi-calc-2.2.0/CHANGELOG.md    2023-04-27 16:16:00.000000000 +0200
@@ -6,8 +6,10 @@
 and this project adheres to [Semantic Versioning](http://semver.org/).
 
 ## [Unreleased] - ReleaseDate
+- Fix high CPU usage when input isn't empty 
[#66](https://github.com/svenstaro/rofi-calc/pull/66) (thanks @bootstrap-prime)
+- Add `-automatic-save-to-history` option 
[#87](https://github.com/svenstaro/rofi-calc/pull/87) (thanks @matejdro)
 
-## [2.0.1] - 2022-02-06
+## [2.1.0] - 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)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/rofi-calc-2.1.0/README.md 
new/rofi-calc-2.2.0/README.md
--- old/rofi-calc-2.1.0/README.md       2022-02-06 19:03:04.000000000 +0100
+++ new/rofi-calc-2.2.0/README.md       2023-04-27 16:16:00.000000000 +0200
@@ -16,7 +16,7 @@
 
     rofi -show calc -modi calc -no-show-match -no-sort
 
-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.
+The result of the current input can be selected with `Ctrl+Return`, and 
history entries can be selected with `Return`. By default this will just output 
the equation/result.
 
 The history file by default sits at 
`$HOME/.local/share/rofi/rofi_calc_history` in case you ever need to delete it 
or change it manually.
 You can disable persistent history if you don't like that.
@@ -40,7 +40,7 @@
 
 * Arch Linux, Gentoo: included with `rofi`, `libqalculate`
 * OpenSUSE: `zypper in rofi rofi-devel qalculate`
-* Debian: `dpkg --install rofi-dev qalc libtool`
+* Debian: `apt install rofi-dev qalc libtool libtool-bin`
 * Ubuntu: `apt install rofi-dev qalc libtool`
 * Solus: `eopkg it rofi-devel libqalculate`
 * CentOS, Fedora: Install `qalculate` (find `rofi-devel` headers yourself)
@@ -51,6 +51,7 @@
 **rofi-calc** uses autotools as build system. If installing from git, the 
following steps should install it:
 
 ```bash
+$ git clone https://github.com/svenstaro/rofi-calc.git
 $ autoreconf -i
 $ mkdir build
 $ cd build/
@@ -101,9 +102,15 @@
 
         rofi -show calc -modi calc -no-show-match -no-sort -no-history -lines 0
 
-    The benefit of this is that you can simply enter a term and press return 
and that'll already
+    The benefit of this is that you can simply enter a term and press `Return` 
and that'll already
     act on the result by printing it to stdout or via `-calc-command` if 
configured.
 
+- To automatically save last calculation to the history on rofi close, use 
`-automatic-save-to-history`.:
+
+        rofi -show calc -modi calc -no-show-match -no-sort 
-automatic-save-to-history
+
+    This means that calculations are put into history even if you don't press 
`Return`.
+
 - To enable thousand separators in the output (e.g. `5 * 12 = 6,000`, rather 
than `6000`) add the following to `~/.config/qalculate/qalc.cfg`
 
     - For `,` separator:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/rofi-calc-2.1.0/src/calc.c 
new/rofi-calc-2.2.0/src/calc.c
--- old/rofi-calc-2.1.0/src/calc.c      2022-02-06 19:03:04.000000000 +0100
+++ new/rofi-calc-2.2.0/src/calc.c      2023-04-27 16:16:00.000000000 +0200
@@ -45,6 +45,7 @@
     char *hint_result;
     char *hint_welcome;
     char *last_result;
+    char *previous_input;
     GPtrArray* history;
 } CALCModePrivateData;
 
@@ -90,6 +91,7 @@
 // History stuff
 #define NO_PERSIST_HISTORY_OPTION "-no-persist-history"
 #define NO_HISTORY_OPTION "-no-history"
+#define AUTOMATIC_SAVE_TO_HISTORY "-automatic-save-to-history"
 #define HISTORY_LENGTH 100
 
 // Limit `str` to at most `limit` new lines.
@@ -161,7 +163,6 @@
     g_free(history_dir);
 }
 
-
 // Count number of new lines in a string.
 static uint32_t get_number_of_newlines(gchar* string, gsize length) {
     uint32_t lines = 0;
@@ -238,6 +239,7 @@
     CALCModePrivateData* pd = (CALCModePrivateData*)mode_get_private_data(sw);
     pd->last_result = g_strdup("");
     pd->history = g_ptr_array_new();
+    pd->previous_input = g_strdup(""); // providing initial value
 
     char *cmd = NULL;
     if (find_arg_str(CALC_COMMAND_OPTION, &cmd)) {
@@ -319,6 +321,16 @@
 }
 
 
+static void append_last_result_to_history(CALCModePrivateData* pd) {
+    if (!is_error_string(pd->last_result) && strlen(pd->last_result) > 0) {
+        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);
+        }
+    }
+}
+
 // Split the equation result into the left (expression) and right (result) side
 // of the equals sign.
 //
@@ -416,13 +428,7 @@
     } else if (menu_entry & MENU_QUICK_SWITCH) {
         retv = (menu_entry & MENU_LOWER_MASK);
     } else if ((menu_entry & MENU_OK) && (selected_line == 0 && 
find_arg(NO_HISTORY_OPTION) == -1)) {
-        if (!is_error_string(pd->last_result) && strlen(pd->last_result) > 0) {
-            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);
-            }
-        }
+        append_last_result_to_history(pd);
         retv = RELOAD_DIALOG;
     } else if ((menu_entry & MENU_OK) && (selected_line > 0 || 
find_arg(NO_HISTORY_OPTION) != -1)) {
         char *entry;
@@ -475,6 +481,10 @@
 static void calc_mode_destroy(Mode* sw)
 {
     CALCModePrivateData* pd = (CALCModePrivateData*)mode_get_private_data(sw);
+    if (find_arg(AUTOMATIC_SAVE_TO_HISTORY) != -1) {
+        append_last_result_to_history(pd);
+    }
+
     if (pd != NULL) {
         g_free(pd);
         mode_set_private_data(sw, NULL);
@@ -550,6 +560,13 @@
     GError *error = NULL;
     CALCModePrivateData* pd = (CALCModePrivateData*)mode_get_private_data(sw);
 
+    if (strcmp(input, pd->previous_input) == 0) {
+        return g_strdup(pd->previous_input);
+    }
+
+    g_free(pd->previous_input);
+    pd->previous_input = g_strdup(input);
+
     char *qalc_binary = "qalc";
     if (find_arg(QALC_BINARY_OPTION) >= 0) {
         find_arg_str(QALC_BINARY_OPTION, &qalc_binary);
@@ -582,6 +599,7 @@
     return g_strdup(input);
 }
 
+
 static char *calc_get_message ( const Mode *sw )
 {
     CALCModePrivateData* pd = (CALCModePrivateData*)mode_get_private_data(sw);

Reply via email to