summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKhaled Hosny <khaled@libreoffice.org>2023-06-22 16:43:09 +0300
committerخالد حسني <khaled@libreoffice.org>2023-06-23 04:58:03 +0200
commit1adae2e08949c5d73b3bc68b9cda81f8614289c0 (patch)
treeee9ed55fd5a7633e0fd2b7068d3ec2622f2c6d62
parentaed0344f9053bddca905d154f2e3b92f35313a7b (diff)
Improve and rename unicode::isIVSSelector()
Check Variation_Selector Unicode property instead of hard-coding variation selector classes. This now handles also Mongolian Variation Selector. Change-Id: I2dd5c4770d7bb9bf4c1e9edc43926fe0863b0da7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153460 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@libreoffice.org>
-rw-r--r--editeng/source/editeng/impedit2.cxx2
-rw-r--r--include/i18nutil/unicode.hxx6
-rw-r--r--sw/source/uibase/wrtsh/delete.cxx2
3 files changed, 5 insertions, 5 deletions
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index a2f88c7a5c5d..1ce5f87e0593 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -2367,7 +2367,7 @@ EditPaM ImpEditEngine::DeleteLeftOrRight( const EditSelection& rSel, sal_uInt8 n
{
const OUString& rString = aCurPos.GetNode()->GetString();
sal_Int32 nCode = rString.iterateCodePoints(&nIndex, -1);
- if (unicode::isIVSSelector(nCode) && nIndex > 0 &&
+ if (unicode::isVariationSelector(nCode) && nIndex > 0 &&
unicode::isCJKIVSCharacter(rString.iterateCodePoints(&nIndex, -1)))
{
nCharMode = i18n::CharacterIteratorMode::SKIPCELL;
diff --git a/include/i18nutil/unicode.hxx b/include/i18nutil/unicode.hxx
index 4d8a84b19c40..3b8091db0c24 100644
--- a/include/i18nutil/unicode.hxx
+++ b/include/i18nutil/unicode.hxx
@@ -22,6 +22,7 @@
#include <com/sun/star/i18n/UnicodeScript.hpp>
#include <sal/types.h>
#include <rtl/ustrbuf.hxx>
+#include <unicode/uchar.h>
#include <unicode/uscript.h>
#include <i18nutil/i18nutildllapi.h>
@@ -55,10 +56,9 @@ public:
@return True if code is a Unicode variation sequence selector.
*/
- static bool isIVSSelector(sal_uInt32 nCode)
+ static bool isVariationSelector(sal_uInt32 nCode)
{
- return (nCode >= 0xFE00 && nCode <= 0xFE0F) // Variation Selectors block
- || (nCode >= 0xE0100 && nCode <= 0xE01EF); // Variation Selectors Supplement block
+ return u_getIntPropertyValue(nCode, UCHAR_VARIATION_SELECTOR) != 0;
}
/** Check for base characters of a CJK ideographic variation sequence (IVS)
diff --git a/sw/source/uibase/wrtsh/delete.cxx b/sw/source/uibase/wrtsh/delete.cxx
index c4c89df82a67..8c21b35bc12d 100644
--- a/sw/source/uibase/wrtsh/delete.cxx
+++ b/sw/source/uibase/wrtsh/delete.cxx
@@ -266,7 +266,7 @@ bool SwWrtShell::DelLeft()
nCode = sStr.iterateCodePoints( &o3tl::temporary(sal_Int32(0)) );
}
- if ( unicode::isIVSSelector( nCode ) )
+ if ( unicode::isVariationSelector( nCode ) )
{
SwCursorShell::Push();
SwCursorShell::Left(1, SwCursorSkipMode::Chars);