Notepad2e icon indicating copy to clipboard operation
Notepad2e copied to clipboard

Math Evaluation: format decimal result according to the locale

Open ProgerXP opened this issue 4 years ago • 8 comments
trafficstars

Currently calculation result is both displayed and copied as 123456.789 in the status bar. Instead, display it according to the region settings (e.g. 123 456,789 in Russian). This doesn't affect copying (the number is still copied in locale-independent format) and doesn't affect display or copy of other bases (e.g. hex).

ProgerXP avatar Jan 09 '21 15:01 ProgerXP

Done.

cshnik avatar Jan 12 '21 18:01 cshnik

Please pay attention to the description.

This doesn't affect copying (the number is still copied in locale-independent format)

ProgerXP avatar Jan 13 '21 14:01 ProgerXP

Please pay attention to the description.

This doesn't affect copying (the number is still copied in locale-independent format)

Fixed.

cshnik avatar Jan 15 '21 14:01 cshnik

Strange issue:

  1. Create new document
  2. Paste 12334567.89 - statusbar is correct
  3. Type Space - statusbar is correct
  4. Type Backsapce - statusbar shows non-localized number

ProgerXP avatar Jan 26 '21 15:01 ProgerXP

Fixed.

cshnik avatar Jan 27 '21 17:01 cshnik

What was the problem?

ProgerXP avatar Jan 27 '21 18:01 ProgerXP

What was the problem?

Cached value was incorrectly calculated and non-localized text string was always used.

cshnik avatar Jan 27 '21 18:01 cshnik

Improvement: if the to-be displayed localized text consists of 0s and no other digits (but non-digits such as separators are allowed), increase the default precision up to the default used when copying (6?). This way, user will see that the expression's result is not 0 but some small value (such as 0,0001).

ProgerXP avatar Sep 30 '22 07:09 ProgerXP

Fixed.

cshnik avatar Oct 30 '22 07:10 cshnik

if (n2e_CheckStringMatchRegexp(tchBuffer, L"0*[.,]0*"))

I don't like the idea of running regexp in this case and I said consists of 0s and no other digits (but non-digits such as separators are allowed) - do a scan for '1'..'9' (regexp equivalent [1-9]). . and , alone may not cover all locales that may use spaces, backticks and other symbols for separators.

ProgerXP avatar Oct 31 '22 10:10 ProgerXP

Done. Recently added n2e_CheckStringMatchRegexp retained for future needs.

cshnik avatar Nov 03 '22 23:11 cshnik