Bug 480607 - Feature request: count the result on the fly
Summary: Feature request: count the result on the fly
Status: RESOLVED FIXED
Alias: None
Product: kcalc
Classification: Applications
Component: general (other bugs)
Version First Reported In: 24.01.95
Platform: Other Linux
: NOR wishlist
Target Milestone: ---
Assignee: Gabriel Barrantes
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-01-31 16:31 UTC by Eugene Savitsky
Modified: 2024-05-07 21:27 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
Step-by-step different situations (70.06 KB, image/png)
2024-03-22 12:58 UTC, Eugene Savitsky
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Eugene Savitsky 2024-01-31 16:31:04 UTC
In bug 470371 was the feature editing the formula added.

Now when you edit the formula you have to press Enter to see the changed result.

I would suggest the counting would automatically go without pressing Enter, on the fly.
When you enter 3+3 the result immediately shows 6, when you change to 3+33 the result immediately shows 36.
Comment 1 Gabriel Barrantes 2024-03-21 23:33:44 UTC

(In reply to ezh from comment #0)
> In bug 470371 was the feature editing the formula added.
> 
> Now when you edit the formula you have to press Enter to see the changed
> result.
> 
> I would suggest the counting would automatically go without pressing Enter,
> on the fly.
> When you enter 3+3 the result immediately shows 6, when you change to 3+33
> the result immediately shows 36.

This would actually be a simple change, however I think it would be better to just clear the result while editing the input, seems more consistent... Because if an invalid input is reached while editing, then the result will disappear and then appear once the input becomes valid again.
Comment 2 Eugene Savitsky 2024-03-22 12:56:25 UTC
(In reply to Gabriel Barrantes from comment #1)

> This would actually be a simple change, however I think it would be better
> to just clear the result while editing the input, seems more consistent...
> Because if an invalid input is reached while editing, then the result will
> disappear and then appear once the input becomes valid again.

I'm using for 24 years this Windows calculator. It changes the result on the fly: 
you add a value and it would immediately counted in the result, no need to press anything else. 
If you get an error (dividing to 0), then to result is shown, if you press enter, then you will get the "error" message.
Comment 3 Eugene Savitsky 2024-03-22 12:58:43 UTC
Created attachment 167602 [details]
Step-by-step different situations

Step-by-step different situations with Advanced Calculator (a year 1999 Windows program).
I may share it if needed, it is a freeware.
Comment 4 Bug Janitor Service 2024-04-05 19:19:27 UTC
A possibly relevant merge request was started @ https://invent.kde.org/utilities/kcalc/-/merge_requests/84
Comment 5 Gabriel Barrantes 2024-04-05 19:30:44 UTC
(In reply to ezh from comment #3)
> Created attachment 167602 [details]
> Step-by-step different situations
> 
> Step-by-step different situations with Advanced Calculator (a year 1999
> Windows program).
> I may share it if needed, it is a freeware.

Feel free to give it a try and provide any relevant feedback.
Comment 6 Eugene Savitsky 2024-04-06 14:29:55 UTC
How can I do that? I'm not a programmer, nor a power user on Linux.
Comment 7 Eugene Savitsky 2024-04-16 21:32:57 UTC
In Neon Unstable I do not see the change.

KCalc
Version 24.04.70
Comment 8 Gabriel Barrantes 2024-05-07 19:24:23 UTC
Git commit 5118570f6f8785ff8f7b471938bbf7b4784a79ce by Gabriel Barrantes.
Committed on 07/05/2024 at 14:45.
Pushed by carlschwan into branch 'master'.

Show result while editing input

Show result while editing input without the need to press the equal
button, if the input reaches an invalid state (non computable) during
editing, result will be cleared or not depending on the error, inputs
that fail to be parsed like "1+#" trigger a result clear, inputs that
yield a math error like "1/0" also clear the result, however intermediate
inputs like "1+2+" will keep the "3" in the result display. If the user
attempts to commit an invalid input using the equal button, an error
message will appear as previously implemented. Changing the base mode
or the trigonometric mode also triggers a result recalculation and update.

A backspace signal clears the result display if the input reaches an
invalid state regardless of the error type.

Results are not committed to history unless the equal button is pressed.

Change default result display to be empty instead of "0", it will also
be empty if the input goes back to empty.

M  +57   -14   kcalc.cpp
M  +4    -1    kcalc.h
M  +30   -16   kcalc_core.cpp
M  +12   -3    kcalc_core.h
M  +10   -3    kcalc_display.cpp

https://invent.kde.org/utilities/kcalc/-/commit/5118570f6f8785ff8f7b471938bbf7b4784a79ce
Comment 9 Gabriel Barrantes 2024-05-07 21:27:31 UTC
Git commit 5118570f6f8785ff8f7b471938bbf7b4784a79ce by Gabriel Barrantes.
Committed on 07/05/2024 at 14:45.
Pushed by carlosdem into branch 'master'.

Show result while editing input

Show result while editing input without the need to press the equal
button, if the input reaches an invalid state (non computable) during
editing, result will be cleared or not depending on the error, inputs
that fail to be parsed like "1+#" trigger a result clear, inputs that
yield a math error like "1/0" also clear the result, however intermediate
inputs like "1+2+" will keep the "3" in the result display. If the user
attempts to commit an invalid input using the equal button, an error
message will appear as previously implemented. Changing the base mode
or the trigonometric mode also triggers a result recalculation and update.

A backspace signal clears the result display if the input reaches an
invalid state regardless of the error type.

Results are not committed to history unless the equal button is pressed.

Change default result display to be empty instead of "0", it will also
be empty if the input goes back to empty.

M  +57   -14   kcalc.cpp
M  +4    -1    kcalc.h
M  +30   -16   kcalc_core.cpp
M  +12   -3    kcalc_core.h
M  +10   -3    kcalc_display.cpp

https://invent.kde.org/neon/snap-packaging/kcalc6/-/commit/5118570f6f8785ff8f7b471938bbf7b4784a79ce