From 44f046af0c6f1d79ef6f189d69ac670bbfba4ac4 Mon Sep 17 00:00:00 2001 From: ocornut Date: Mon, 5 Jul 2021 17:22:24 +0200 Subject: [PATCH] stb_textedit: Fix paste failure handling breaking undo stack Could lead to freezes. Fixes issue #734. --- stb_textedit.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/stb_textedit.h b/stb_textedit.h index 90543b0..5bb3a57 100644 --- a/stb_textedit.h +++ b/stb_textedit.h @@ -712,9 +712,7 @@ 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; + // 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; }