Merge lp:~tintou/pantheon-calculator/comma+dot into lp:~elementary-apps/pantheon-calculator/trunk

Proposed by Corentin Noël
Status: Merged
Approved by: Cody Garver
Approved revision: 224
Merged at revision: 224
Proposed branch: lp:~tintou/pantheon-calculator/comma+dot
Merge into: lp:~elementary-apps/pantheon-calculator/trunk
Diff against target: 30 lines (+3/-3)
1 file modified
src/Core/Scanner.vala (+3/-3)
To merge this branch: bzr merge lp:~tintou/pantheon-calculator/comma+dot
Reviewer Review Type Date Requested Status
Zisu Andrei (community) Approve
Review via email: mp+295773@code.launchpad.net

Commit message

Allow dot character for decimal even for countries that use a comma (lp:1469757)

Description of the change

Accepting the dot for decimal is more convenient for everyone

To post a comment you must log in.
Revision history for this message
Zisu Andrei (matzipan) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Core/Scanner.vala'
2--- src/Core/Scanner.vala 2015-04-05 08:14:49 +0000
3+++ src/Core/Scanner.vala 2016-05-25 22:17:49 +0000
4@@ -60,7 +60,7 @@
5
6 type = scanner.next (out start, out len);
7 for (ssize_t i = start; i < (start + len); i++) {
8- if (scanner.uc[i] == scanner.decimal_symbol)
9+ if (scanner.uc[i] == scanner.decimal_symbol || scanner.uc[i] == '.')
10 substr += ".";
11 else
12 substr += scanner.uc[i].to_string ();
13@@ -113,7 +113,7 @@
14
15 private TokenType next (out ssize_t start, out ssize_t len) throws SCANNER_ERROR {
16 start = pos;
17- if (uc[pos] == this.decimal_symbol) {
18+ if (uc[pos] == this.decimal_symbol || this.uc[pos] == '.') {
19 pos++;
20 while (uc[pos].isdigit () && pos < uc.length)
21 pos++;
22@@ -122,7 +122,7 @@
23 } else if (uc[pos].isdigit ()) {
24 while (uc[pos].isdigit () && pos < uc.length)
25 pos++;
26- if (uc[pos] == this.decimal_symbol)
27+ if (uc[pos] == this.decimal_symbol || this.uc[pos] == '.')
28 pos++;
29 while (uc[pos].isdigit () && pos < uc.length)
30 pos++;

Subscribers

People subscribed via source and target branches

to all changes: