1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-22 04:53:29 +01:00

additional text input fixes for emoji

This commit is contained in:
Ell 2023-07-17 15:56:25 +02:00
parent fda22de83d
commit 62a7a89834
2 changed files with 2 additions and 2 deletions

View file

@ -71,7 +71,7 @@ namespace MLEM.Font {
/// <returns>An index close to <paramref name="index"/>, but not between surrogates.</returns> /// <returns>An index close to <paramref name="index"/>, but not between surrogates.</returns>
public int EnsureSurrogateBoundary(int index, bool increase) { public int EnsureSurrogateBoundary(int index, bool increase) {
if (index < this.Length && char.IsLowSurrogate(this[index])) if (index < this.Length && char.IsLowSurrogate(this[index]))
return increase && index < this.Length - 1 || index <= 0 ? index + 1 : index - 1; return increase || index <= 0 ? index + 1 : index - 1;
return index; return index;
} }

View file

@ -419,7 +419,7 @@ namespace MLEM.Input {
this.CaretPos = destStart + destAccum.Length; this.CaretPos = destStart + destAccum.Length;
return true; return true;
} }
destAccum += this.text[destStart + destAccum.Length]; destAccum += CodePointSource.ToString(new CodePointSource(this.text).GetCodePoint(destStart + destAccum.Length).CodePoint);
} }
// if we don't find a proper position, just move to the end of the destination line // if we don't find a proper position, just move to the end of the destination line
this.CaretPos = destEnd; this.CaretPos = destEnd;