mirror of
https://github.com/ddnet/ddnet.git
synced 2024-09-20 09:34:19 +00:00
Arrow keys should account for visibility
This commit is contained in:
parent
ad566aa158
commit
4fedd91020
|
@ -4153,9 +4153,11 @@ void CEditor::RenderFileDialog()
|
||||||
int ScrollNum = 0;
|
int ScrollNum = 0;
|
||||||
for(int i = 0; i < m_FileList.size(); i++)
|
for(int i = 0; i < m_FileList.size(); i++)
|
||||||
{
|
{
|
||||||
|
m_FileList[i].m_IsVisible = false;
|
||||||
if(!m_aFileDialogSearchText[0] || str_find_nocase(m_FileList[i].m_aName, m_aFileDialogSearchText))
|
if(!m_aFileDialogSearchText[0] || str_find_nocase(m_FileList[i].m_aName, m_aFileDialogSearchText))
|
||||||
{
|
{
|
||||||
AddFileDialogEntry(i, &View);
|
AddFileDialogEntry(i, &View);
|
||||||
|
m_FileList[i].m_IsVisible = true;
|
||||||
ScrollNum++;
|
ScrollNum++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4171,6 +4173,10 @@ void CEditor::RenderFileDialog()
|
||||||
else
|
else
|
||||||
ScrollNum = 0;
|
ScrollNum = 0;
|
||||||
|
|
||||||
|
if(!m_FileList[m_FilesSelectedIndex].m_IsVisible)
|
||||||
|
{
|
||||||
|
m_FilesSelectedIndex = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if(m_FilesSelectedIndex > -1)
|
if(m_FilesSelectedIndex > -1)
|
||||||
{
|
{
|
||||||
|
@ -4179,8 +4185,24 @@ void CEditor::RenderFileDialog()
|
||||||
int NewIndex = -1;
|
int NewIndex = -1;
|
||||||
if(Input()->GetEvent(i).m_Flags&IInput::FLAG_PRESS)
|
if(Input()->GetEvent(i).m_Flags&IInput::FLAG_PRESS)
|
||||||
{
|
{
|
||||||
if(Input()->GetEvent(i).m_Key == KEY_DOWN) NewIndex = m_FilesSelectedIndex + 1;
|
if(Input()->GetEvent(i).m_Key == KEY_DOWN)
|
||||||
if(Input()->GetEvent(i).m_Key == KEY_UP) NewIndex = m_FilesSelectedIndex - 1;
|
{
|
||||||
|
for(NewIndex = m_FilesSelectedIndex + 1; NewIndex < m_FileList.size(); NewIndex++)
|
||||||
|
{
|
||||||
|
if(m_FileList[NewIndex].m_IsVisible)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
dbg_msg("DEBUG", "NewIndex='%d'", NewIndex);
|
||||||
|
}
|
||||||
|
if(Input()->GetEvent(i).m_Key == KEY_UP)
|
||||||
|
{
|
||||||
|
for(NewIndex = m_FilesSelectedIndex - 1; NewIndex >= 0; NewIndex--)
|
||||||
|
{
|
||||||
|
if(m_FileList[NewIndex].m_IsVisible)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
dbg_msg("DEBUG", "NewIndex='%d'", NewIndex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(NewIndex > -1 && NewIndex < m_FileList.size())
|
if(NewIndex > -1 && NewIndex < m_FileList.size())
|
||||||
{
|
{
|
||||||
|
|
|
@ -859,6 +859,7 @@ public:
|
||||||
bool m_IsDir;
|
bool m_IsDir;
|
||||||
bool m_IsLink;
|
bool m_IsLink;
|
||||||
int m_StorageType;
|
int m_StorageType;
|
||||||
|
bool m_IsVisible;
|
||||||
|
|
||||||
bool operator<(const CFilelistItem &Other) { return !str_comp(m_aFilename, "..") ? true : !str_comp(Other.m_aFilename, "..") ? false :
|
bool operator<(const CFilelistItem &Other) { return !str_comp(m_aFilename, "..") ? true : !str_comp(Other.m_aFilename, "..") ? false :
|
||||||
m_IsDir && !Other.m_IsDir ? true : !m_IsDir && Other.m_IsDir ? false :
|
m_IsDir && !Other.m_IsDir ? true : !m_IsDir && Other.m_IsDir ? false :
|
||||||
|
|
Loading…
Reference in a new issue