Hello community, here is the log from the commit of package rofi-calc for openSUSE:Factory checked in at 2020-11-17 21:24:13 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rofi-calc (Old) and /work/SRC/openSUSE:Factory/.rofi-calc.new.24930 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rofi-calc" Tue Nov 17 21:24:13 2020 rev:11 rq:848801 version:2.0.0 Changes: -------- --- /work/SRC/openSUSE:Factory/rofi-calc/rofi-calc.changes 2020-09-24 16:15:10.140954127 +0200 +++ /work/SRC/openSUSE:Factory/.rofi-calc.new.24930/rofi-calc.changes 2020-11-17 21:24:16.977318143 +0100 @@ -1,0 +2,6 @@ +Mon Nov 16 07:22:30 UTC 2020 - Michael Vetter <[email protected]> + +- Update to 2.0.0: + * Add option to completely disable history #63 + +------------------------------------------------------------------- Old: ---- v1.9.tar.gz New: ---- v2.0.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rofi-calc.spec ++++++ --- /var/tmp/diff_new_pack.f91hGP/_old 2020-11-17 21:24:19.637320781 +0100 +++ /var/tmp/diff_new_pack.f91hGP/_new 2020-11-17 21:24:19.641320786 +0100 @@ -17,7 +17,7 @@ Name: rofi-calc -Version: 1.9 +Version: 2.0.0 Release: 0 Summary: Calculator for rofi License: MIT ++++++ v1.9.tar.gz -> v2.0.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rofi-calc-1.9/CHANGELOG.md new/rofi-calc-2.0.0/CHANGELOG.md --- old/rofi-calc-1.9/CHANGELOG.md 2020-09-24 01:44:03.000000000 +0200 +++ new/rofi-calc-2.0.0/CHANGELOG.md 2020-11-14 12:19:57.000000000 +0100 @@ -1,8 +1,22 @@ # Changelog +All notable changes to this project will be documented in this file. + +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 +- Add option to completely disable history [#63](https://github.com/svenstaro/rofi-calc/pull/63) (thanks @UnkwUsr) + +## [1.9] - 2020-09-24 - Add options to specify output hints [#59](https://github.com/svenstaro/rofi-calc/pull/59) (thanks @sa5gap) ## [1.8] - 2020-08-13 - Enable qalc's Unicode mode by default - Add `-no-unicode` option to disable aforementioned unicode support + +<!-- next-url --> +[Unreleased]: https://github.com/svenstaro/rofi-calc/compare/v1.9...HEAD +[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-1.9/README.md new/rofi-calc-2.0.0/README.md --- old/rofi-calc-1.9/README.md 2020-09-24 01:44:03.000000000 +0200 +++ new/rofi-calc-2.0.0/README.md 2020-11-14 12:19:57.000000000 +0100 @@ -19,6 +19,7 @@ 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 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. ## Installation @@ -82,9 +83,19 @@ rofi -show calc -modi calc -no-show-match -no-sort -no-bold -- To disable the history, use `-no-history`: +- To disable persistent history, use `-no-persist-history`: - rofi -show calc -modi calc -no-show-match -no-sort -no-history + rofi -show calc -modi calc -no-show-match -no-sort -no-persist-history + + This will disable writing and loading the history file and thus you'll lose and entered entries + upon quitting rofi-calc. + +- To disable the history entirely, use `-no-history`: + + 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 + act on the result by printing it to stdout or via `-calc-command` if configured. - To enable thousand separators in the output (e.g. `5 * 12 = 6,000`, rather than `6000`) add the following to `~/.config/qalculate/qalc.cfg` @@ -100,7 +111,7 @@ set `LC_NUMERIC` to a different value like this: LC_NUMERIC=de_DE.UTF-8 rofi -show calc -modi calc -no-show-match -no-sort - + - To set a different default locale, set your `LC_MONETARY` variable: LC_MONETARY=de_DE.UTF-8 rofi -show calc -modi calc -no-show-match -no-sort diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rofi-calc-1.9/src/calc.c new/rofi-calc-2.0.0/src/calc.c --- old/rofi-calc-1.9/src/calc.c 2020-09-24 01:44:03.000000000 +0200 +++ new/rofi-calc-2.0.0/src/calc.c 2020-11-14 12:19:57.000000000 +0100 @@ -83,12 +83,11 @@ #define EQUATION_LHS_KEY "{expression}" #define EQUATION_RHS_KEY "{result}" - // History stuff +#define NO_PERSIST_HISTORY_OPTION "-no-persist-history" #define NO_HISTORY_OPTION "-no-history" #define HISTORY_LENGTH 100 - // Limit `str` to at most `limit` new lines. // Returns a new string of either the limited length or the length length. // However, in both cases, it's a new string. @@ -241,15 +240,15 @@ pd->cmd = g_strdup(cmd); } - pd->hint_result = find_arg_str(HINT_RESULT, &cmd) - ? g_strdup(cmd) + pd->hint_result = find_arg_str(HINT_RESULT, &cmd) + ? g_strdup(cmd) : HINT_RESULT_STR; - pd->hint_welcome = find_arg_str(HINT_WELCOME, &cmd) - ? g_strdup(cmd) + pd->hint_welcome = find_arg_str(HINT_WELCOME, &cmd) + ? g_strdup(cmd) : HINT_WELCOME_STR; - if (find_arg(NO_HISTORY_OPTION) == -1) { + if (find_arg(NO_PERSIST_HISTORY_OPTION) == -1 && find_arg(NO_HISTORY_OPTION) == -1) { // Load old history if it exists. GError *error = NULL; gchar* history_file = g_build_filename(g_get_user_data_dir(), "rofi", "rofi_calc_history", NULL); @@ -396,17 +395,22 @@ retv = PREVIOUS_DIALOG; } else if (menu_entry & MENU_QUICK_SWITCH) { retv = (menu_entry & MENU_LOWER_MASK); - } else if ((menu_entry & MENU_OK) && selected_line == 0) { + } 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_HISTORY_OPTION) == -1) { + if (find_arg(NO_PERSIST_HISTORY_OPTION) == -1) { append_str_to_history(history_entry); } } retv = RELOAD_DIALOG; - } else if ((menu_entry & MENU_OK) && selected_line > 0) { - char* entry = g_ptr_array_index(pd->history, get_real_history_index(pd->history, selected_line)); + } else if ((menu_entry & MENU_OK) && (selected_line > 0 || find_arg(NO_HISTORY_OPTION) != -1)) { + char *entry; + if (find_arg(NO_HISTORY_OPTION) != -1) + entry = pd->last_result; + else + entry = g_ptr_array_index(pd->history, get_real_history_index(pd->history, selected_line)); + execsh(pd->cmd, entry); retv = MODE_EXIT; } else if (menu_entry & MENU_CUSTOM_INPUT) { @@ -419,7 +423,7 @@ } else if (menu_entry & MENU_ENTRY_DELETE) { if (selected_line > 0) { g_ptr_array_remove_index(pd->history, get_real_history_index(pd->history, selected_line)); - if (find_arg(NO_HISTORY_OPTION) == -1) { + if (find_arg(NO_PERSIST_HISTORY_OPTION) == -1 && find_arg(NO_HISTORY_OPTION) == -1) { delete_line_from_history(selected_line - 1); } } @@ -458,7 +462,10 @@ } if (selected_line == 0) { - return g_strdup("Add to history"); + if (find_arg(NO_HISTORY_OPTION) == -1) + return g_strdup("Add to history"); + else + return g_strdup(""); } unsigned int real_index = get_real_history_index(pd->history, selected_line); return g_strdup(g_ptr_array_index(pd->history, real_index)); _______________________________________________ openSUSE Commits mailing list -- [email protected] To unsubscribe, email [email protected] List Netiquette: https://en.opensuse.org/openSUSE:Mailing_list_netiquette List Archives: https://lists.opensuse.org/archives/list/[email protected]
