Adjust CursorPos to respect UTF symbols as one and not separate entities

This commit is contained in:
Infi
2024-04-10 21:48:43 +02:00
parent c1ba97353a
commit 27e08064af
+6 -2
View File
@@ -1290,10 +1290,14 @@ public sealed class ChatLogWindow : Window, IUiComponent {
} }
} }
var start = ptr.Buf + white + 1;
var end = ptr.CursorPos - white - 1;
var utf8Message = Marshal.PtrToStringUTF8(start, end);
var correctedCursor = ptr.CursorPos - (end - utf8Message.Length);
_autoCompleteInfo = new AutoCompleteInfo( _autoCompleteInfo = new AutoCompleteInfo(
Marshal.PtrToStringUTF8(ptr.Buf + white + 1, ptr.CursorPos - white - 1), utf8Message,
white + 1, white + 1,
ptr.CursorPos correctedCursor
); );
_autoCompleteOpen = true; _autoCompleteOpen = true;
_autoCompleteSelection = 0; _autoCompleteSelection = 0;