mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
Get byte index of last rune in textfield
This commit is contained in:
@@ -176,7 +176,7 @@ namespace Terminal.Gui {
|
||||
int RuneIndexToByteIndex (int index)
|
||||
{
|
||||
var blen = text.Length;
|
||||
for (int byteIndex = 0, runeIndex = 0; byteIndex < blen; runeIndex++) {
|
||||
for (int byteIndex = 0, runeIndex = 0; byteIndex <= blen; runeIndex++) {
|
||||
if (index == runeIndex)
|
||||
return byteIndex;
|
||||
(var rune, var size) = Utf8.DecodeRune (text, byteIndex, byteIndex - blen);
|
||||
|
||||
Reference in New Issue
Block a user