stb_textedit internally allows for a single undo record to do addition and deletion, but somehow, calling the stb_textedit_paste() function creates two separate records, so we perform it manually. (FIXME: Report to nothings/stb?)
| 3720 | // stb_textedit internally allows for a single undo record to do addition and deletion, but somehow, calling |
| 3721 | // the stb_textedit_paste() function creates two separate records, so we perform it manually. (FIXME: Report to nothings/stb?) |
| 3722 | static void stb_textedit_replace(ImGuiInputTextState* str, STB_TexteditState* state, const STB_TEXTEDIT_CHARTYPE* text, int text_len) |
| 3723 | { |
| 3724 | stb_text_makeundo_replace(str, state, 0, str->CurLenW, text_len); |
| 3725 | ImStb::STB_TEXTEDIT_DELETECHARS(str, 0, str->CurLenW); |
| 3726 | if (text_len <= 0) |
| 3727 | return; |
| 3728 | if (ImStb::STB_TEXTEDIT_INSERTCHARS(str, 0, text, text_len)) |
| 3729 | { |
| 3730 | state->cursor = text_len; |
| 3731 | state->has_preferred_x = 0; |
| 3732 | return; |
| 3733 | } |
| 3734 | IM_ASSERT(0); // Failed to insert character, normally shouldn't happen because of how we currently use stb_textedit_replace() |
| 3735 | } |
| 3736 | |
| 3737 | } // namespace ImStb |
| 3738 |
no test coverage detected