[LyX/2.3.x] Use Common Number separator instead of European to detect numbers
Jean-Marc Lasgouttes
lasgouttes at lyx.org
Sat Jul 11 18:43:58 UTC 2020
commit 4804f637400627ef031bca55b8395d68bf63122a
Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
Date: Fri Jul 10 17:17:15 2020 +0200
Use Common Number separator instead of European to detect numbers
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 | 6 +++---
src/support/lstrings.cpp | 4 ++--
src/support/textutils.h | 4 ++--
status.23x | 2 ++
4 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/src/Text.cpp b/src/Text.cpp
index c961a43..0c27d51 100644
--- a/src/Text.cpp
+++ b/src/Text.cpp
@@ -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,
diff --git a/src/support/lstrings.cpp b/src/support/lstrings.cpp
index 21fe05a..6b5596d 100644
--- a/src/support/lstrings.cpp
+++ b/src/support/lstrings.cpp
@@ -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;
}
diff --git a/src/support/textutils.h b/src/support/textutils.h
index 314ea75..3c29c92 100644
--- a/src/support/textutils.h
+++ b/src/support/textutils.h
@@ -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]
diff --git a/status.23x b/status.23x
index e9b30fd..3b94c32 100644
--- a/status.23x
+++ b/status.23x
@@ -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
More information about the lyx-cvs
mailing list