]> git.lyx.org Git - lyx.git/commitdiff
Use Common Number separator instead of European to detect numbers
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 10 Jul 2020 15:17:15 +0000 (17:17 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Sat, 11 Jul 2020 19:06:35 +0000 (21:06 +0200)
This is a fixup to commit 611df441. It seems that the wrong unicode
property was selected. It could be that both classes should be used.

Fixes bug #11900.

(cherry picked from commit f758894c2fc78f33be0c8bd60c2fd0a1f470056e)

src/Text.cpp
src/support/lstrings.cpp
src/support/textutils.h
status.23x

index c961a43e472be28d0774fc0c21b4e27b04f0f77e..0c27d51fa2e51f1eeffa77ec4c348252d760254b 100644 (file)
@@ -970,11 +970,11 @@ void Text::insertChar(Cursor & cur, char_type c)
                static docstring const number_operators = from_ascii("+-/*");
                static docstring const number_unary_operators = from_ascii("+-");
 
-               // European Number Separators: comma, dot etc.
+               // Common Number Separators: comma, dot etc.
                // European Number Terminators: percent, permille, degree, euro etc.
                if (cur.current_font.fontInfo().number() == FONT_ON) {
                        if (!isDigitASCII(c) && !contains(number_operators, c) &&
-                           !(isEuropeanNumberSeparator(c) &&
+                           !(isCommonNumberSeparator(c) &&
                              cur.pos() != 0 &&
                              cur.pos() != cur.lastpos() &&
                              tm.displayFont(pit, cur.pos()).fontInfo().number() == FONT_ON &&
@@ -999,7 +999,7 @@ void Text::insertChar(Cursor & cur, char_type c)
                                  ) {
                                        setCharFont(pit, cur.pos() - 1, cur.current_font,
                                                tm.font_);
-                               } else if (isEuropeanNumberSeparator(c)
+                               } else if (isCommonNumberSeparator(c)
                                     && cur.pos() >= 2
                                     && tm.displayFont(pit, cur.pos() - 2).fontInfo().number() == FONT_ON) {
                                        setCharFont(pit, cur.pos() - 1, cur.current_font,
index 21fe05aa09389fb1e04b7518529d64793fe395ab..6b5596d7e1ad6a3b5a0c3773e4eef24dce4db687 100644 (file)
@@ -164,13 +164,13 @@ bool isNumber(char_type c)
 }
 
 
-bool isEuropeanNumberSeparator(char_type c)
+bool isCommonNumberSeparator(char_type c)
 {
        if (!is_utf16(c))
                // assume that no non-utf16 character is a numeral
                // c outside the UCS4 range is catched as well
                return false;
-       return ucs4_to_qchar(c).direction() == QChar::DirES;
+       return ucs4_to_qchar(c).direction() == QChar::DirCS;
 }
 
 
index 314ea7588d26943b281f177b9c2d532f9d0e37ae..3c29c9223cbb6dd2ef0c63b0445849c0bee9ad2c 100644 (file)
@@ -45,8 +45,8 @@ bool isSpace(char_type c);
 bool isNumber(char_type c);
 
 /// return true if a unicode char has the direction attribute
-/// European Number Separator [ES]
-bool isEuropeanNumberSeparator(char_type c);
+/// Common Number Separator [CS]
+bool isCommonNumberSeparator(char_type c);
 
 /// return true if a unicode char has the direction attribute
 /// European Number Terminator [ET]
index e9b30fd954cf4af7768ba9fbcc45fef26f785a66..3b94c325f71363b92780881bae6814d2966f655d 100644 (file)
@@ -66,6 +66,8 @@ What's new
 
 - Fix language when pasting multiple cell outside table (bug 11898).
 
+- Fix input of decimal numbers in RtL context (bug 11900).
+
 
 * INTERNALS