Fix slash removal when multiple slashes are pasted in editor

When pasting text containing multiple consecutive (back)slashes in the editor save dialog not all slashes where removed. For example with the text `/a//bb/\/ccc////dddd//\//`.
This commit is contained in:
Robert Müller 2023-03-14 13:29:04 +01:00
parent 254f4fa882
commit 1e74e06908

View file

@ -4317,8 +4317,13 @@ void CEditor::RenderFileDialog()
{
// remove '/' and '\'
for(int i = 0; m_aFileDialogFileName[i]; ++i)
{
if(m_aFileDialogFileName[i] == '/' || m_aFileDialogFileName[i] == '\\')
{
str_copy(&m_aFileDialogFileName[i], &m_aFileDialogFileName[i + 1], (int)(sizeof(m_aFileDialogFileName)) - i);
--i;
}
}
m_FilesSelectedIndex = -1;
m_aFilesSelectedName[0] = '\0';
// find first valid entry, if it exists