Skip to content

Commit

Permalink
Fixed Typing doesn't replace selection right in text field (ZeVg3yWo6Z)
Browse files Browse the repository at this point in the history
  • Loading branch information
Neko-Box-Coder committed May 25, 2023
1 parent c30a050 commit e46077d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Src/Tests/ManualTests/GUIObjectTests/TextTest_Manual.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ void SetUp()
TestText->SetText("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor "\
"incididunt ut labore et dolore magna aliqua.\nJust\ta\tsentence\tfor\ttesting\ttabs.\na\ta\ta\ta\ta\ta\ta");

//TestText->SetText("Test Text");

TestFont = ssGUI::Create<ssGUI::Font>();
TestFont->LoadFromMemory((void*)ssGUI_Test_NotoSans_Bold, ssGUI_Test_NotoSans_Bold_size);
}
Expand Down
3 changes: 2 additions & 1 deletion Src/ssGUI/GUIObjectClasses/TextField.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,8 @@ namespace ssGUI

void TextField::TextInputUpdate(std::wstring& textInput, bool& refreshBlinkTimer, bool& wordMode)
{
int insertIndex = (GetEndSelectionIndex() >= 0 && GetEndSelectionIndex() <= GetText().size()) ? GetEndSelectionIndex() : 0;
int insertIndex = GetStartSelectionIndex() > GetEndSelectionIndex() ? GetStartSelectionIndex() : GetEndSelectionIndex();
insertIndex = (insertIndex >= 0 && insertIndex <= GetText().size()) ? insertIndex : 0;

ssGUI::CharacterDetails baseCD;
if(insertIndex - 1 >= 0)
Expand Down

0 comments on commit e46077d

Please sign in to comment.