| 5672 | } |
| 5673 | |
| 5674 | void ImGui::DebugNodeInputTextState(ImGuiInputTextState* state) |
| 5675 | { |
| 5676 | #ifndef IMGUI_DISABLE_DEBUG_TOOLS |
| 5677 | ImGuiContext& g = *GImGui; |
| 5678 | ImStb::STB_TexteditState* stb_state = state->Stb; |
| 5679 | ImStb::StbUndoState* undo_state = &stb_state->undostate; |
| 5680 | Text("ID: 0x%08X, ActiveID: 0x%08X", state->ID, g.ActiveId); |
| 5681 | DebugLocateItemOnHover(state->ID); |
| 5682 | Text("TextLen: %d, Cursor: %d%s, Selection: %d..%d", state->TextLen, stb_state->cursor, |
| 5683 | (state->Flags & ImGuiInputTextFlags_WordWrap) ? (state->LastMoveDirectionLR == ImGuiDir_Left ? " (L)" : " (R)") : "", |
| 5684 | stb_state->select_start, stb_state->select_end); |
| 5685 | Text("BufCapacity: %d, LineCount: %d", state->BufCapacity, state->LineCount); |
| 5686 | Text("(Internal Buffer: TextA Size: %d, Capacity: %d)", state->TextA.Size, state->TextA.Capacity); |
| 5687 | Text("has_preferred_x: %d (%.2f)", stb_state->has_preferred_x, stb_state->preferred_x); |
| 5688 | Text("undo_point: %d, redo_point: %d, undo_char_point: %d, redo_char_point: %d", undo_state->undo_point, undo_state->redo_point, undo_state->undo_char_point, undo_state->redo_char_point); |
| 5689 | if (BeginChild("undopoints", ImVec2(0.0f, GetTextLineHeight() * 10), ImGuiChildFlags_Borders | ImGuiChildFlags_ResizeY)) // Visualize undo state |
| 5690 | { |
| 5691 | PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0)); |
| 5692 | for (int n = 0; n < IMSTB_TEXTEDIT_UNDOSTATECOUNT; n++) |
| 5693 | { |
| 5694 | ImStb::StbUndoRecord* undo_rec = &undo_state->undo_rec[n]; |
| 5695 | const char undo_rec_type = (n < undo_state->undo_point) ? 'u' : (n >= undo_state->redo_point) ? 'r' : ' '; |
| 5696 | if (undo_rec_type == ' ') |
| 5697 | BeginDisabled(); |
| 5698 | const int buf_preview_len = (undo_rec_type != ' ' && undo_rec->char_storage != -1) ? undo_rec->insert_length : 0; |
| 5699 | const char* buf_preview_str = undo_state->undo_char + undo_rec->char_storage; |
| 5700 | Text("%c [%02d] where %03d, insert %03d, delete %03d, char_storage %03d \"%.*s\"", |
| 5701 | undo_rec_type, n, undo_rec->where, undo_rec->insert_length, undo_rec->delete_length, undo_rec->char_storage, buf_preview_len, buf_preview_str); |
| 5702 | if (undo_rec_type == ' ') |
| 5703 | EndDisabled(); |
| 5704 | } |
| 5705 | PopStyleVar(); |
| 5706 | } |
| 5707 | EndChild(); |
| 5708 | #else |
| 5709 | IM_UNUSED(state); |
| 5710 | #endif |
| 5711 | } |
| 5712 | |
| 5713 | //------------------------------------------------------------------------- |
| 5714 | // [SECTION] Widgets: ColorEdit, ColorPicker, ColorButton, etc. |