CuteCalc icon indicating copy to clipboard operation
CuteCalc copied to clipboard

UI/UX Improvements & Bugs

Open recycledunit opened this issue 10 months ago • 15 comments

Description of improvements

  • Option to disable error message on precalculation – it's annoying to constantly see an error when entering the expression (or this message should be displayed only after pressing the “=” button)
  • Long press on backspace clears field
  • Option to disable "C" button (if the previous function is added)
  • Clicking on a field ignores the keyboard call (I think it useless and causes bugs I've described below)

Bugs

  • When the keyboard is invoked, the cursor moves to the left and keyboard input is also added to the left side (after that you can't move cursor)
  • It's probably not a bug, but sum and subtraction of interest gives the wrong result (e.g., 10 + 50% gives 10.5, not the expected 15).

recycledunit avatar Feb 04 '25 08:02 recycledunit

Hello ! For the last one, I'm pretty sure it's normal, if not it's a Keval problem then D:

sosauce avatar Feb 04 '25 13:02 sosauce

And do you know about another app that lets you hide the C button ? I'm questionning this request from an UI perspective 🤔

sosauce avatar Feb 04 '25 13:02 sosauce

Unitto has this option as well as the correct algorithm for calculating percentages

Your app is so stylish and pure, good luck with your development!

recycledunit avatar Feb 04 '25 15:02 recycledunit

Thanks !! ❤

@notKamui Is the perentage thingy normal here ? (sorry for the tag)

sosauce avatar Feb 04 '25 15:02 sosauce

@sosauce Yes, I've said it before, but your implementation of the % operator (cf the image)

Image

it is not a relative percentage. Here, it only divides by 100 the left unary operand. So 10 + 50% is 10 + (50/100) which is indeed 10.5

You have to implement the relative percentage yourself

notKamui avatar Feb 06 '25 09:02 notKamui

Oh yes I remember sorry ! Well I'll implement it, I won't bother you with expression issues anymore !

sosauce avatar Feb 06 '25 09:02 sosauce

To give you a hint, you need to preprocess your string, and in fact, that is EXACTLY how Unitto does it too (I checked): They never evaluate 10 + 50% as 10 plus 50 percent of 10, instead, they expand the expression before evaluation, which is non trivial, because there is nothing in this expression that clears ambiguity.

In fact, you should not think of % as an operator in this expression (if you want it to be relative)

The actual operator is +% which is a binary operator, where the first operand is before the +, and the second operand is between the + and %.

Which also means that -% is an operator in itself, and *% too

notKamui avatar Feb 06 '25 09:02 notKamui

Hey @recycledunit, just release v2.4.0 which fixed all your problems (including relative percentage calculation, I hope), tell me if everything's good and feel free to close this issue if everything is 😉 !

sosauce avatar Feb 06 '25 21:02 sosauce

Hi @sosauce, that's awesome! But I found a few more improvements (sorry for that XD):

  • When "=" is pressed, the result duplicates in both fields – it would be better if the result was only displayed in the main field

  • If you try to solve an invalid expression, an error message will appear in the main field (and it'll be editable) – the error message should be displayed only in the precalculation field and the expression itself should not be erased

  • With the cursor invoked and decimal formatting enabled, when attempting to solve any expression whose result is greater than or equal to a four-digit number, the cursor moves one digit to the left (interestingly, moving the cursor to the end causes the result of the precalculation to disappear, and any subsequent operations will not be evaluated)

recycledunit avatar Feb 07 '25 07:02 recycledunit

@sosauce I checked your implementation, it wont work for (10 + 10) + 50% or 10 + (10+40)%. It may also lead to incoherent results in cases such as 10 / 50% or event just 50% (instead of errors)

notKamui avatar Feb 07 '25 10:02 notKamui

Why is that ? Is it messing up with order of priority ? (I'm assuming this since both of your examples include parenthesis)

sosauce avatar Feb 07 '25 14:02 sosauce

Because your regex ((\d+(?:\.\d+)?)\s*([+\-*])\s*(\d+(?:\.\d+)?)%) doesn't take into account groups.

I suppose you generated it using ChatGPT or something, but next time, do actually try to understand it.

What this regex represents is a "maybe ONE number" followed by either a +, -, or *, followed by ONE number followed by %.

(10 + 10) + 50% obviously does not abide to it

It's not even a problem of priority, it is simply that your regex is just wrong

https://regexr.com/8bu3f

notKamui avatar Feb 08 '25 13:02 notKamui

Thanks ! But I actually updated it (Locally only) to account for groups before you told me too ahah 😅 And yeah I asked chatgpt for it, but oh we know how not trust worthy AI is.

sosauce avatar Feb 08 '25 13:02 sosauce

Hey @notKamui, I (hopefully) fixed the issue (By myself I promise 😄)

sosauce avatar Mar 11 '25 17:03 sosauce

Without looking too hard into it, this seems correct. Good job 👍

notKamui avatar Mar 12 '25 10:03 notKamui