mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-13 03:28:19 +00:00
Merge #6420
6420: Fix slash removal when multiple slashes are pasted in editor r=def- a=Robyt3 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//\//`. ## Checklist - [X] Tested the change ingame - [ ] Provided screenshots if it is a visual change - [ ] Tested in combination with possibly related configuration options - [ ] Written a unit test (especially base/) or added coverage to integration test - [ ] Considered possible null pointers and out of bounds array indexing - [ ] Changed no physics that affect existing maps - [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional) Co-authored-by: Robert Müller <robytemueller@gmail.com>
This commit is contained in:
commit
862137a11e
|
@ -4317,8 +4317,13 @@ void CEditor::RenderFileDialog()
|
||||||
{
|
{
|
||||||
// remove '/' and '\'
|
// remove '/' and '\'
|
||||||
for(int i = 0; m_aFileDialogFileName[i]; ++i)
|
for(int i = 0; m_aFileDialogFileName[i]; ++i)
|
||||||
|
{
|
||||||
if(m_aFileDialogFileName[i] == '/' || m_aFileDialogFileName[i] == '\\')
|
if(m_aFileDialogFileName[i] == '/' || m_aFileDialogFileName[i] == '\\')
|
||||||
|
{
|
||||||
str_copy(&m_aFileDialogFileName[i], &m_aFileDialogFileName[i + 1], (int)(sizeof(m_aFileDialogFileName)) - i);
|
str_copy(&m_aFileDialogFileName[i], &m_aFileDialogFileName[i + 1], (int)(sizeof(m_aFileDialogFileName)) - i);
|
||||||
|
--i;
|
||||||
|
}
|
||||||
|
}
|
||||||
m_FilesSelectedIndex = -1;
|
m_FilesSelectedIndex = -1;
|
||||||
m_aFilesSelectedName[0] = '\0';
|
m_aFilesSelectedName[0] = '\0';
|
||||||
// find first valid entry, if it exists
|
// find first valid entry, if it exists
|
||||||
|
|
Loading…
Reference in a new issue