Search: Implemented highlighting of a letters from the search string

This commit is contained in:
YuSanka 2020-03-31 22:46:12 +02:00
parent abad9133eb
commit 042880ba2d
4 changed files with 118 additions and 13 deletions

View file

@ -33,6 +33,7 @@ Index of this file:
#define IMGUI_DEFINE_MATH_OPERATORS
#endif
#include "imgui_internal.h"
#include "imconfig.h"
#include <stdio.h> // vsnprintf, sscanf, printf
#if !defined(alloca)
@ -2991,6 +2992,8 @@ void ImFont::RenderText(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col
ImDrawIdx* idx_write = draw_list->_IdxWritePtr;
unsigned int vtx_current_idx = draw_list->_VtxCurrentIdx;
ImU32 defaultCol = col;
while (s < text_end)
{
if (word_wrap_enabled)
@ -3019,6 +3022,17 @@ void ImFont::RenderText(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col
}
}
if (*s == ImGui::ColorMarkerStart) {
col = ImGui::GetColorU32(ImGuiCol_ButtonHovered);
s += 1;
}
else if (*s == ImGui::ColorMarkerEnd) {
col = defaultCol;
s += 1;
if (s == text_end)
break;
}
// Decode and advance source
unsigned int c = (unsigned int)*s;
if (c < 0x80)