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?)
| 3828 | // stb_textedit internally allows for a single undo record to do addition and deletion, but somehow, calling |
| 3829 | // the stb_textedit_paste() function creates two separate records, so we perform it manually. (FIXME: Report to nothings/stb?) |
| 3830 | static void stb_textedit_replace(ImGuiInputTextState* str, STB_TexteditState* state, const IMSTB_TEXTEDIT_CHARTYPE* text, int text_len) |
| 3831 | { |
| 3832 | stb_text_makeundo_replace(str, state, 0, str->CurLenW, text_len); |
| 3833 | ImStb::STB_TEXTEDIT_DELETECHARS(str, 0, str->CurLenW); |
| 3834 | state->cursor = state->select_start = state->select_end = 0; |
| 3835 | if (text_len <= 0) |
| 3836 | return; |
| 3837 | if (ImStb::STB_TEXTEDIT_INSERTCHARS(str, 0, text, text_len)) |
| 3838 | { |
| 3839 | state->cursor = state->select_start = state->select_end = text_len; |
| 3840 | state->has_preferred_x = 0; |
| 3841 | return; |
| 3842 | } |
| 3843 | IM_ASSERT(0); // Failed to insert character, normally shouldn't happen because of how we currently use stb_textedit_replace() |
| 3844 | } |
| 3845 | |
| 3846 | } // namespace ImStb |
| 3847 |
no test coverage detected