Darkempire78 / OpenCalc

A simple and beautiful calculator for Android
GNU General Public License v3.0
737 stars 82 forks source link

Deleting first digit also deletes following zeroes #275

Closed min7-i closed 2 months ago

min7-i commented 1 year ago

Describe the bug When deleting the first digit of a number that starts with a digit [1-9] and is followed by two or more zeroes, e.g. 100, 10.000, etc., the first digit and all zeroes except for the last one are deleted.

For example if I want to replace 100 by 200 I would place the cursor behind the 1 press delete and type 2. Currently this does not work because 1 and 0 are both deleted.

To Reproduce Steps to reproduce the behavior:

  1. Enter a number with at least two zeroes, e.g. 100
  2. Place the cursor behind the first digit => 1
  3. Press the delete button
  4. Not only the 1 but also the 0 following the 1 is deleted

Expected behavior Only the digit after which the cursor is placed should be deleted when pressing the delete button.

Screenshots/videos Here is a screen recording showing the issue:

https://user-images.githubusercontent.com/97251923/233308308-78beeaef-514b-4e12-8cbd-940d872ebbf1.mp4

Smartphone (please complete the following information):

Additional context This also happens with numbers like 100250,23 (where a comma is the decimal separator). When deleting the first digit, the two zeroes are also removed, leaving 250,23 as the remaining digits instead of 00250,23.

inson1 commented 7 months ago

I think its feature, not bug. And I dont mind this feature. But yea for example Google calculator doesnt have this feature. Maybe it would be best if there would be option in settings what should happen. Idk what should be the default option.

Darkempire78 commented 7 months ago

I think its feature, not bug. And I dont mind this feature. But yea for example Google calculator doesnt have this feature. Maybe it would be best if there would be option in settings what should happen. Idk what should be the default option.

You are right, we can add an option for that, it's not a big deal. I think that the Google system is more naturel

Darkempire78 commented 2 months ago

fixed