Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI/UX Improvements & Bugs #80

Open
recycledunit opened this issue Feb 4, 2025 · 13 comments
Open

UI/UX Improvements & Bugs #80

recycledunit opened this issue Feb 4, 2025 · 13 comments

Comments

@recycledunit
Copy link

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 recycledunit changed the title UI Improvements & Bugs UI/UX Improvements & Bugs Feb 4, 2025
@sosauce
Copy link
Owner

sosauce commented Feb 4, 2025

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

@sosauce
Copy link
Owner

sosauce commented Feb 4, 2025

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

@recycledunit
Copy link
Author

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!

@sosauce
Copy link
Owner

sosauce commented Feb 4, 2025

Thanks !! ❤

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

@notKamui
Copy link
Contributor

notKamui commented Feb 6, 2025

@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

@sosauce
Copy link
Owner

sosauce commented Feb 6, 2025

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

@notKamui
Copy link
Contributor

notKamui commented Feb 6, 2025

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

@sosauce
Copy link
Owner

sosauce commented Feb 6, 2025

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 😉 !

@recycledunit
Copy link
Author

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)

@notKamui
Copy link
Contributor

notKamui commented Feb 7, 2025

@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)

@sosauce
Copy link
Owner

sosauce commented Feb 7, 2025

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

@notKamui
Copy link
Contributor

notKamui commented Feb 8, 2025

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

@sosauce
Copy link
Owner

sosauce commented Feb 8, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants