gnucash maint: Multiple changes pushed

John Ralls jralls at code.gnucash.org
Mon Jul 20 15:54:03 EDT 2020


Updated	 via  https://github.com/Gnucash/gnucash/commit/e9a1d491 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/f6cd83a1 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/15b54037 (commit)
	from  https://github.com/Gnucash/gnucash/commit/8ef370ce (commit)



commit e9a1d491251ee3845ceaa026315903d932c0c670
Author: John Ralls <jralls at ceridwen.us>
Date:   Sun Jul 19 13:54:10 2020 -0700

    Quickfill cells: Remove the selection after a delete.
    
    So that new characters aren't selected afterwards.

diff --git a/gnucash/register/register-core/quickfillcell.c b/gnucash/register/register-core/quickfillcell.c
index fee256612..39332eeab 100644
--- a/gnucash/register/register-core/quickfillcell.c
+++ b/gnucash/register/register-core/quickfillcell.c
@@ -192,6 +192,8 @@ gnc_quickfill_cell_modify_verify (BasicCell *_cell,
             gnc_quickfill_cell_set_original (cell, NULL);
 
         gnc_basic_cell_set_value_internal (&cell->cell, newval);
+        // Remove any selection.
+        *end_selection = *start_selection = *cursor_position;
         return;
     }
 

commit f6cd83a1d168e8145234b4af6542c2b17c25e44e
Author: John Ralls <jralls at ceridwen.us>
Date:   Sun Jul 19 13:37:41 2020 -0700

    Bug 797845 - Backspace key produces incorrect result
    
    gnucash_sheet_delete_cb should always reset the entry to the returned
    value because the combo-box manipulations might have reset it to the
    combo box value. Also always stop the delete signal because otherwise
    the gtk_entry delete handler will dupllicate the deletion.

diff --git a/gnucash/register/register-gnome/gnucash-sheet.c b/gnucash/register/register-gnome/gnucash-sheet.c
index 30aeb718c..fd2ea8113 100644
--- a/gnucash/register/register-gnome/gnucash-sheet.c
+++ b/gnucash/register/register-gnome/gnucash-sheet.c
@@ -1195,18 +1195,10 @@ gnucash_sheet_delete_cb (GtkWidget *widget,
                                       &start_sel, &end_sel,
                                       &sheet->input_cancelled);
 
-    if (retval && (strcmp (retval, new_text) != 0))
-    {
+    if (retval)
         gnucash_sheet_set_entry_value (sheet, retval);
-        g_signal_stop_emission_by_name (G_OBJECT(sheet->entry),
-                                        "delete_text");
-    }
-    else if (retval == NULL)
-    {
-        /* the entry was disallowed, so we stop the delete signal */
-        g_signal_stop_emission_by_name (G_OBJECT(sheet->entry),
-                                        "delete_text");
-    }
+
+    g_signal_stop_emission_by_name (G_OBJECT(sheet->entry), "delete_text");
 
     DEBUG ("%s", retval ? retval : "nothing");
     gnucash_sheet_set_position_and_selection (sheet, cursor_position,

commit 15b540370a397fc02932cc059f95e6c32e7b3ee3
Author: John Ralls <jralls at ceridwen.us>
Date:   Sun Jul 19 12:00:48 2020 -0700

    Bug 797844 - Typing account number to select account fails
    
    Both the account separator and the input string might have regular
    expression special characters that will screw up regex matching.
    Escape both to ensure that matching works correctly.

diff --git a/gnucash/register/register-gnome/combocell-gnome.c b/gnucash/register/register-gnome/combocell-gnome.c
index 6b8223a5d..27add82e7 100644
--- a/gnucash/register/register-gnome/combocell-gnome.c
+++ b/gnucash/register/register-gnome/combocell-gnome.c
@@ -530,9 +530,11 @@ gnc_combo_cell_type_ahead_search (const gchar* newval,
     int num_found = 0;
     gchar* match_str = NULL;
     const char* sep = gnc_get_account_separator_string ();
-    gchar* newval_rep = g_strdup_printf (".*%s.*", sep);
-    GRegex* regex0 = g_regex_new (sep, 0, 0, NULL);
-    char* rep_str = g_regex_replace_literal (regex0, newval, -1, 0,
+    char* escaped_sep = g_regex_escape_string (sep, -1);
+    char* escaped_newval = g_regex_escape_string (newval, -1);
+    gchar* newval_rep = g_strdup_printf (".*%s.*", escaped_sep);
+    GRegex* regex0 = g_regex_new (escaped_sep, 0, 0, NULL);
+    char* rep_str = g_regex_replace_literal (regex0, escaped_newval, -1, 0,
                                              newval_rep, 0, NULL);
     GRegex *regex = g_regex_new (rep_str, G_REGEX_CASELESS, 0, NULL);
 
@@ -546,6 +548,8 @@ gnc_combo_cell_type_ahead_search (const gchar* newval,
 
     g_free (rep_str);
     g_free (newval_rep);
+    g_free (escaped_sep);
+    g_free (escaped_newval);
     g_regex_unref (regex0);
 
     block_list_signals (cell); //Prevent recursion from gtk_tree_view signals.



Summary of changes:
 gnucash/register/register-core/quickfillcell.c    |  2 ++
 gnucash/register/register-gnome/combocell-gnome.c | 10 +++++++---
 gnucash/register/register-gnome/gnucash-sheet.c   | 14 +++-----------
 3 files changed, 12 insertions(+), 14 deletions(-)



More information about the gnucash-changes mailing list