summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2022-01-20 17:11:32 +0100
committerEike Rathke <erack@redhat.com>2022-01-21 02:03:17 +0100
commitea933cc3b6d72b1d7ff09c9e85286f4d3343f335 (patch)
treea283abf2d0e14568ceca3aa9a4dad82544da0156 /editeng
parent33d24b08677ef45ea7525d8f7f762f152988ea8e (diff)
Related: tdf#139974 Keep HYPHEN-MINUS with a number to the right
Force line break 1234567890 -1234567890 instead of 1234567890- 1234567890 but still abcdef- abcdef Change-Id: I0b427b33b05eea12d13aad148c604385ffe000d2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128691 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/editeng/impedit2.cxx19
1 files changed, 16 insertions, 3 deletions
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index 171aa676f009..36747c1c8666 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -2756,11 +2756,24 @@ EditPaM ImpEditEngine::ImpInsertText(const EditSelection& aCurSel, const OUStrin
{
const sal_Unicode c = aLine[nPos];
// Ignore NO-BREAK spaces, NBSP, NNBSP, ZWNBSP.
- if (c != 0x00A0 && c != 0x202F && c != 0xFEFF)
+ if (c == 0x00A0 || c == 0x202F || c == 0xFEFF)
+ break;
+ if (c == '-' && nPos + 1 < nMaxNewChars)
{
- nMaxNewChars = nPos + 1; // line break after
- nPos = 0; // will break loop
+ // Keep HYPHEN-MINUS with a number to the right.
+ const sal_Int16 t = unicode::getUnicodeType(aLine[nPos+1]);
+ if ( t == css::i18n::UnicodeType::DECIMAL_DIGIT_NUMBER ||
+ t == css::i18n::UnicodeType::LETTER_NUMBER ||
+ t == css::i18n::UnicodeType::OTHER_NUMBER)
+ nMaxNewChars = nPos; // line break before
+ else
+ nMaxNewChars = nPos + 1; // line break after
}
+ else
+ {
+ nMaxNewChars = nPos + 1; // line break after
+ }
+ nPos = 0; // will break loop
}
}
}