summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAldrik Ramaekers <aldrikboy@gmail.com>2024-03-09 21:39:40 +0100
committerAldrik Ramaekers <aldrikboy@gmail.com>2024-03-09 21:39:40 +0100
commit8df6671acae6d301b645ffd6abcedc819d3f5365 (patch)
treeff73cb3f71ba319c6cf73f36d7daddbc9497e617 /src
parent92b2ad31658ffad3d6401c7aa278eace89480bc7 (diff)
show indentation with arrow
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp
index abdc170..345657f 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -261,7 +261,23 @@ void _ts_create_text_match_rows() {
ImGui::Text("#%d", item+1);
ImGui::TableNextColumn();
- ImGui::Text("%.*s", (int)file->word_match_offset, file->line_info);
+
+ utf8_int32_t iter_ch = 0;
+ utf8_int8_t* iter = file->line_info;
+ size_t whitespace_size = 0;
+ while ((iter = utf8codepoint(iter, &iter_ch)) && iter_ch)
+ {
+ if (iter_ch == ' ') {
+ ImGui::TextColored({0,0,0,0.2f}, "%s", "→");
+ ImGui::SameLine(0.0f, 5.0f);
+ whitespace_size++;
+ }
+ else {
+ break;
+ }
+ }
+
+ ImGui::Text("%.*s", (int)(file->word_match_offset - whitespace_size), file->line_info + whitespace_size);
ImGui::SameLine(0.0f, 0.0f);
ImGui::TextColored({255,0,0,255}, "%.*s", (int)file->word_match_length, file->line_info + file->word_match_offset);
ImGui::SameLine(0.0f, 0.0f);