InputText: Fix handling of paste failure (buffer full) which in some cases could corrupt the undo stack. (#4038)

This commit is contained in:
ocornut
2021-07-05 17:48:19 +02:00
parent 327a5d8253
commit d9b606672a
2 changed files with 7 additions and 3 deletions

View File

@ -716,9 +716,11 @@ static int stb_textedit_paste_internal(STB_TEXTEDIT_STRING *str, STB_TexteditSta
state->has_preferred_x = 0;
return 1;
}
// remove the undo since we didn't actually insert the characters
if (state->undostate.undo_point)
--state->undostate.undo_point;
// [DEAR IMGUI]
//// remove the undo since we didn't actually insert the characters
//if (state->undostate.undo_point)
// --state->undostate.undo_point;
// note: paste failure will leave deleted selection, may be restored with an undo (see https://github.com/nothings/stb/issues/734 for details)
return 0;
}