GNOME Bugzilla – Bug 766155
Unable to reuse results from history
Last modified: 2016-10-11 08:22:39 UTC
In the previous version of gnome-calculator (3.18.x), you were able to reuse history by clicking either the result or the calculation and that would display at the cursor point in the entry field. This behaviour seems to have changed in 3.20.x, and I'm wondering if this is a dropped feature or a bug, as it was really useful for large calculations involving multiple stages.
I can confirm this, I am running gnome-calculator on a Gnome/Arch setup.
Hi, the regression has been introduced in commit 9bb6936ba74602ec891c1ffecdf1665dba1a1be4 Reverting it would fix the issue, however we don't want to do this because using GtkBuilder is cleaner indeed. AFAIU the issue happens because the history entries are GtkLabels (https://git.gnome.org/browse/gnome-calculator/tree/data/history-entry.ui), and it looks like a GtkLabel cannot get the button-press-event directly, the Gtk docs say so in https://developer.gnome.org/gtk3/unstable/GtkLabel.html#gtk-label-get-layout-offsets and in fact the previous procedural code used GtkEventBox containers for the labels to get the events. I'll see if I can do the same using GtkBuilder, but feel free to anticipate me, I am still pretty new to these things. Ciao ciao, Antonio
Created attachment 331236 [details] [review] Fix reusing results from the history stack OK, the attached patch seems to fix it for me.
After fixing the issue I noticed that clicking on the equation in the history stack has a different behavior that clicking on the result: - A click on the equation would replace the current expression - A click on the result would append it to the current expression Is this difference expected?
*** Bug 770858 has been marked as a duplicate of this bug. ***
(In reply to Antonio Ospite from comment #4) > After fixing the issue I noticed that clicking on the equation in the > history stack has a different behavior that clicking on the result: > > - A click on the equation would replace the current expression > - A click on the result would append it to the current expression > > Is this difference expected? I'm not sure on that, but I assume yes (this seems to be implemented for a reason), as I might have a typo in the original equation, in which case I do not want to enter it again, so I click the equation, and edit it in the equation editor, but if I just need the result, than I click that. You get what you clicked, and I feel it is natural.
Attachment 331236 [details] pushed as c088882 - Fix reusing results from the history stack
This is a bit confusing to me now. Clicking on 9+4 from the history stack replaces the current equation or line. This makes sense to me. However clicking on 13 appends 13 to 9+4. It shows 9+413. Is this the expected behavior by design?
(In reply to Hussam Al-Tayeb from comment #8) > This is a bit confusing to me now. > Clicking on 9+4 from the history stack replaces the current equation or > line. This makes sense to me. > However clicking on 13 appends 13 to 9+4. It shows 9+413. Is this the > expected behavior by design? Hmm... good question. It seems to make sense to append the result e.g. if you have "9+", but indeed, appending if we have "9+4" is strange, as it's probably not something you want. However, I'm not sure what should happen when clicking the result in this case. * Should the result replace the current equation completely? That would break the use-case of really reusing a result in new equations. * Maybe we should append if we have an equation ending with a binary operator, and replace otherwise? Suggestions are welcome. In any case, clicking the result/equation works now, so this bug seems to be fixed, we just have to define how to smartly decide whether to append or replace, as append makes sense in some cases, but doesn't make sense in other cases. Let us take that discussion to another ticket.