stb_textedit: Fix paste failure handling breaking undo stack

Could lead to freezes.

Fixes issue #734.
This commit is contained in:
ocornut 2021-07-05 17:22:24 +02:00 committed by Fabian Giesen
parent eb677dda6e
commit 44f046af0c

View File

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