Reset scroll when search text changes. Fix #1331

This commit is contained in:
Learath 2018-10-08 18:38:22 +03:00
parent a09fa562be
commit 5c4203b747
2 changed files with 5 additions and 0 deletions

View file

@ -4126,6 +4126,7 @@ void CEditor::RenderFileDialog()
static float s_SearchBoxID = 0;
UI()->DoLabel(&FileBoxLabel, "Search:", 10.0f, -1, -1);
str_copy(m_aFileDialogPrevSearchText, m_aFileDialogSearchText, sizeof(m_aFileDialogPrevSearchText));
DoEditBox(&s_SearchBoxID, &FileBox, m_aFileDialogSearchText, sizeof(m_aFileDialogSearchText), 10.0f, &s_SearchBoxID,false,CUI::CORNER_L);
// clearSearchbox button
@ -4139,6 +4140,9 @@ void CEditor::RenderFileDialog()
UI()->SetActiveItem(&s_SearchBoxID);
}
}
if(str_comp(m_aFileDialogPrevSearchText, m_aFileDialogSearchText))
m_FileDialogScrollValue = 0.0f;
}
int Num = (int)(View.h/17.0f)+1;

View file

@ -840,6 +840,7 @@ public:
char m_aFileDialogCurrentFolder[MAX_PATH_LENGTH];
char m_aFileDialogCurrentLink[MAX_PATH_LENGTH];
char m_aFileDialogSearchText[64];
char m_aFileDialogPrevSearchText[64];
char *m_pFileDialogPath;
bool m_aFileDialogActivate;
int m_FileDialogFileType;