Fixes #2333. TextField is selecting badly a word on double click.#2334
Fixes #2333. TextField is selecting badly a word on double click.#2334tig merged 3 commits intogui-cs:developfrom
Conversation
|
Nice find, good catch! |
I'm confused by the phrasing here. Regardless, I think it would help make the TextField code more clear if we renamed the Old: public class TextField : View {
List<Rune> text;New: public class TextField : View {
List<Rune> runes;Also, note I found this by searching for List<Rune> DeleteSelectedText ()
{
ustring actualText = Text;
SetSelectedStartSelectedLength ();
int selStart = SelectedStart > -1 ? start : point;
(var _, var len) = TextModel.DisplaySize (text, 0, selStart, false);
(var _, var len2) = TextModel.DisplaySize (text, selStart, selStart + length, false);
(var _, var len3) = TextModel.DisplaySize (text, selStart + length, actualText.RuneCount, false);
var newText = actualText [0, len] +
actualText [len + len2, len + len2 + len3];
ClearAllSelection ();
point = selStart >= newText.RuneCount ? newText.RuneCount : selStart;
return newText.ToRuneList ();
}Is this code incorrect too? I don't think so, since it's counting Runes, but figured i'd ask. FWIW, I searched the entire project for |
I said they are indexed as byte and it's true, see bellow.
I fully agree.
Yes it's correct because the
Before I submitted this PR I already also had searched and found only the one I fixed, but it's not accurate that may haven't this bug on another place. |
Nice work @BDisp. See #92 ;-) |

Fixes #2333 - We shouldn't ever use indexing with the Text property to compare chars, because they are indexed as byte instead of the representation of the displayed character.
Pull Request checklist:
CTRL-K-Dto automatically reformat your files before committing.dotnet testbefore commit///style comments)