changeset 111:48f260576059

[PostDog] Rewriting it from scratch as it is unreadable for me.
author June Park <parkjune1995@gmail.com>
date Sun, 04 Jan 2026 06:39:16 -0800
parents 99c4530e4629
children d6d578b49a19
files postdog/BUILD postdog/main.c previous.c seobeo/os/s_linux_edge.c third_party/raylib/include/raygui.h
diffstat 5 files changed, 1052 insertions(+), 827 deletions(-) [+]
line wrap: on
line diff
--- a/postdog/BUILD	Sat Jan 03 21:16:17 2026 -0800
+++ b/postdog/BUILD	Sun Jan 04 06:39:16 2026 -0800
@@ -6,6 +6,7 @@
   srcs = ["main.c"],
   deps = [
     "//third_party/raylib:raylib",
+    "//dowa:dowa"
   ],
   linkopts_macos = [
     "-framework CoreVideo",
@@ -22,6 +23,7 @@
     "-ldl",
     "-lrt",
     "-lX11",
+    "-lcurl",
   ],
   static = True
 )
--- a/postdog/main.c	Sat Jan 03 21:16:17 2026 -0800
+++ b/postdog/main.c	Sun Jan 04 06:39:16 2026 -0800
@@ -1,15 +1,11 @@
-/**
- * Entirely written by Claude AI.
- */
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>
 #include <sys/stat.h>
 #include <dirent.h>
-
+#include "dowa/dowa.h"
 
-// third party
 #include <curl/curl.h>
 #include "third_party/raylib/include/raylib.h"
 #define RAYGUI_IMPLEMENTATION
@@ -62,7 +58,6 @@
   ActiveTab_Params,
 } ActiveTab;
 
-// Callback function for curl to write response data
 static size_t Postdog_Curl_Callback(void *contents, size_t size, size_t nmemb, void *userp)
 {
   size_t real_size = size * nmemb;
@@ -83,7 +78,6 @@
   return real_size;
 }
 
-// Function to make HTTP request using curl
 int PostDog_Make_HttpRequest(const char *url, const char *method, const char *headers,
                     const char *body, char *response, size_t responseSize)
 {
@@ -159,9 +153,10 @@
     // Perform request
     res = curl_easy_perform(curl);
 
-    if (res != CURLE_OK) {
+    if (res != CURLE_OK)
       snprintf(response, responseSize, "Error: %s\n", curl_easy_strerror(res));
-    } else {
+    else
+    {
       long response_code;
       curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &response_code);
 
@@ -182,709 +177,148 @@
   return 0;
 }
 
-void PostDog_HistoryDirectory_Exists()
-{
-  struct stat st = {0};
-  if (stat("history", &st) == -1)
-  {
-    mkdir("history", 0700);
-  }
-}
-
-int PostDog_HistoryDistory_ItemsLoad(HistoryItem *items, int maxItems)
-{
-  DIR *dir = opendir("history");
-  if (!dir) return 0;
-
-  struct dirent *entry;
-  int count = 0;
-
-  while ((entry = readdir(dir)) != NULL && count < maxItems)
-  {
-    if (entry->d_name[0] == '.') continue;
-    if (strstr(entry->d_name, ".txt") == NULL) continue;
-
-    // Parse filename: YYYYMMDD_HHMMSS_METHOD.txt
-    strncpy(items[count].filename, entry->d_name, sizeof(items[count].filename) - 1);
-
-    // Extract method from filename
-    char *methodStart = strrchr(entry->d_name, '_');
-    if (methodStart)
-    {
-      methodStart++; // Skip underscore
-      char *dotPos = strchr(methodStart, '.');
-      if (dotPos) {
-        int len = dotPos - methodStart;
-        if (len < 16) {
-          strncpy(items[count].method, methodStart, len);
-          items[count].method[len] = '\0';
-        }
-      }
-    }
-
-    // Create display name: METHOD - YYYYMMDD HHMMSS
-    char dateTime[32] = "";
-    if (strlen(entry->d_name) >= 15)
-    {
-      snprintf(dateTime, sizeof(dateTime), "%.8s %.6s",
-               entry->d_name, entry->d_name + 9);
-    }
-    snprintf(items[count].displayName, sizeof(items[count].displayName),
-             "%s - %s", items[count].method, dateTime);
-    count++;
-  }
-
-  closedir(dir);
-  return count;
-}
-
-int PostDog_HistoryDirectory_LoadRequest(const char *filename, char *url, char *method, char *headers, char *body)
-{
-  char filepath[512];
-  snprintf(filepath, sizeof(filepath), "history/%s", filename);
-
-  FILE *f = fopen(filepath, "r");
-  if (!f) return -1;
-
-  char line[2048];
-  int section = 0; // 0=url, 1=method, 2=headers, 3=body
-
-  url[0] = '\0';
-  method[0] = '\0';
-  headers[0] = '\0';
-  body[0] = '\0';
-
-  while (fgets(line, sizeof(line), f))
-  {
-    // Remove newline
-    line[strcspn(line, "\n")] = 0;
-
-    if (section == 0)
-    {
-      // First line is URL
-      strncpy(url, line, 1024 - 1);
-      section = 1;
-    } 
-    else if (strncmp(line, "Method: ", 8) == 0)
-    {
-      strncpy(method, line + 8, 15);
-      section = 2;
-    }
-    else if (strncmp(line, "Headers:", 8) == 0)
-    {
-      section = 2;
-    }
-    else if (strcmp(line, "---") == 0)
-    {
-      section = 3;
-    }
-    else if (strncmp(line, "Body:", 5) == 0)
-    {
-      section = 3;
-    }
-    else if (section == 2 && strcmp(line, "None") != 0)
-    {
-      // Add header line
-      if (strlen(headers) > 0) strcat(headers, "\n");
-      strncat(headers, line, HEADER_INPUT_BUFFER_LEN - strlen(headers) - 1);
-    }
-    else if (section == 3 && strcmp(line, "None") != 0)
-    {
-      // Add body line
-      if (strlen(body) > 0) strcat(body, "\n");
-      strncat(body, line, JSON_INPUT_BUFFER_LEN - strlen(body) - 1);
-    }
-  }
-
-  fclose(f);
-  return 0;
-}
-
-void Postdog_UpdateUrlWithParams(char *url, size_t urlSize, const char *baseUrl, const char *params)
-{
-  // Find if there's already a ? in the URL
-  char *questionMark = strchr(baseUrl, '?');
-
-  if (questionMark != NULL) {
-    // URL already has params, just copy the base
-    strncpy(url, baseUrl, urlSize - 1);
-  } else {
-    // No params yet, add them
-    snprintf(url, urlSize, "%s", baseUrl);
-  }
-
-  // Parse and append params
-  if (params && strlen(params) > 0) {
-    char *paramsCopy = strdup(params);
-    char *line = strtok(paramsCopy, "\n");
-    bool firstParam = (questionMark == NULL);
-
-    while (line != NULL) {
-      // Trim whitespace
-      while (*line == ' ' || *line == '\t') line++;
-
-      if (strlen(line) > 0 && strchr(line, '=')) {
-        size_t currentLen = strlen(url);
-        if (currentLen + 2 < urlSize) {
-          strcat(url, firstParam ? "?" : "&");
-          firstParam = false;
-          strncat(url, line, urlSize - strlen(url) - 1);
-        }
-      }
-      line = strtok(NULL, "\n");
-    }
-    free(paramsCopy);
-  }
-}
-
-// Save request to history file
-void Postdog_SaveRequestToHistory(const char *url, const char *method, const char *headers, const char *body)
-{
-  PostDog_HistoryDirectory_Exists();
-
-  // Generate filename with timestamp
-  time_t now = time(NULL);
-  struct tm *t = localtime(&now);
-  char filename[256];
-  snprintf(filename, sizeof(filename), "history/%04d%02d%02d_%02d%02d%02d_%s.txt",
-           t->tm_year + 1900, t->tm_mon + 1, t->tm_mday,
-           t->tm_hour, t->tm_min, t->tm_sec, method);
-
-  FILE *f = fopen(filename, "w");
-  if (f == NULL) {
-    printf("Failed to create history file\n");
-    return;
-  }
-
-  // Write URL
-  fprintf(f, "%s\n", url);
-
-  // Write method
-  fprintf(f, "Method: %s\n", method);
-
-  // Write headers
-  fprintf(f, "Headers:\n");
-  if (headers && strlen(headers) > 0)
-  {
-    fprintf(f, "%s\n", headers);
-  }
-  else
-  {
-    fprintf(f, "None\n");
-  }
-
-  fprintf(f, "---\n");
-
-  // Write body
-  fprintf(f, "Body:\n");
-  if (body && strlen(body) > 0)
-  {
-    fprintf(f, "%s\n", body);
-  }
-  else
-  {
-    fprintf(f, "None\n");
-  }
-
-  fclose(f);
-  printf("Request saved to %s\n", filename);
-}
-
-void PostDog_Render_TextWithScroll(Rectangle textArea, Vector2 scroll, char *input)
-{
-  BeginScissorMode(textArea.x, textArea.y, textArea.width, textArea.height);
-  
-  int yPos = textArea.y + 5 - (int)scroll.y;
-  int charactersPerLine = (int)(textArea.width / (TEXT_SIZE/1.5)); // Account for padding
-  int totalPos = 0;
-  int inputLen = strlen(input);
-  
-  while (totalPos < inputLen)
-  {
-    int lineEnd = totalPos;
-    int lineLength = 0;
-    
-    while (lineEnd < inputLen && lineLength < charactersPerLine && input[lineEnd] != '\n')
-    {
-      lineEnd++;
-      lineLength++;
-    }
-    
-    if (yPos + LINE_HEIGHT > textArea.y && yPos < textArea.y + textArea.height)
-    {
-      char savedChar = input[lineEnd];
-      input[lineEnd] = '\0';
-      DrawText(&input[totalPos], textArea.x + 5, yPos, TEXT_SIZE, DARKGRAY);
-      input[lineEnd] = savedChar;
-    }
-    
-    yPos += LINE_HEIGHT;
-    
-    totalPos = lineEnd;
-    if (totalPos < inputLen && input[totalPos] == '\n')
-    {
-      totalPos++;
-    }
-  }
-  
-  EndScissorMode();
-}
+typedef struct {
+  Rectangle rectangle;
+  char *label;
+} TabItem;
 
 int main()
 {
-  InitWindow(SCREEN_WIDTH, SCREEN_HEIGHT, "PostDog - HTTP Client");
+  // -- initizlied --//
+  InitWindow(SCREEN_WIDTH, SCREEN_HEIGHT, "PostDog");
   SetWindowState(FLAG_WINDOW_RESIZABLE);
   SetTargetFPS(60);
 
-  PostDog_HistoryDirectory_Exists();
+  Dowa_Arena *arena = Dowa_Arena_Create(1024 * 1025 * 10);
 
-  // UI State
-  char urlInput[1024] = "https://httpbin.org/get";
-  bool urlEditMode = false;
+  // -- Starting pos ---//
+  float side_bar_x = 10;
+  float side_bar_y = 10;
 
-  char jsonInput[JSON_INPUT_BUFFER_LEN] = "{\"key\":\"value\"}";
-  bool jsonEditMode = false;
+  Rectangle history_sidebar = { .x = side_bar_x, .y = side_bar_y, .width = 0, .height = 0 };
 
-  char headersInput[HEADER_INPUT_BUFFER_LEN] = "Content-Type: application/json";
-  bool headersEditMode = false;
-
-  char responseText[16384] = "Response will appear here...\n\nTry the default URL or enter your own!";
+  Rectangle url_area = { 0 };
+  Rectangle textBounds = { 0 };
+  Rectangle url_input_bounds = { 0 };
+  Rectangle url_text_bounds = { 0 };
+  Rectangle url_enter_button = { 0 };
 
-  char paramsInput[PARAM_INPUT_BUFFER_LEN] = "key1=value1\nkey2=value2";
-  bool paramsEditMode = false;
-
-  ActiveTab activeTab = ActiveTab_JSON; // 0 = JSON, 1 = Headers, 2 = Params
+  char *input_text = (char *)Dowa_Arena_Allocate(arena, 1024 * 4);
+  int sendRequest;
 
-  // HTTP method selection
-  int methodActive = 0;
-  bool methodDropdown = false;
-  const char *methods[] = { "GET", "POST", "PUT", "DELETE" };
+  Rectangle input_area = { 0 };
+  Rectangle input_tab = { 0 };
+  TabItem input_tab_items[4] = {
+    {
+      .rectangle={0}, .label="body"
+    },
+    {
+      .rectangle={0}, .label="header"
+    },
+    {
+      .rectangle={0}, .label="foo"
+    },
+    {
+      .rectangle={0}, .label="bar"
+    },
+  };
+  Rectangle input_body = { 0 };
 
-  // Scroll support
-  Vector2 jsonScroll = { 0, 0 };
-  Vector2 headersScroll = { 0, 0 };
-  Vector2 paramsScroll = { 0, 0 };
-  Vector2 responseScroll = { 0, 0 };
-  Vector2 historyScroll = { 0, 0 };
+  Rectangle result_area = { 0 };
+  Rectangle result_body = { 0 };
 
-  // History
-  HistoryItem historyItems[MAX_HISTORY_ITEMS];
-  int historyCount = 0;
-  int selectedHistoryIndex = -1;
+  // General styling.
+  int padding = 10; // TODO make it % based?
 
-  // Load initial history
-  historyCount = PostDog_HistoryDistory_ItemsLoad(historyItems, MAX_HISTORY_ITEMS);
 
   while (!WindowShouldClose())
   {
-    // Get current window dimensions for responsive layout
-    int screenWidth = GetScreenWidth();
-    int screenHeight = GetScreenHeight();
+    int screen_width = GetScreenWidth();
+    int screen_height = GetScreenHeight();
+
+    history_sidebar.width = screen_width * 0.15;
+    history_sidebar.height = screen_width - 10;
 
-    // Layout calculations
-    Rectangle sidebar = { 0, 10, SIDEBAR_WIDTH, screenHeight };
-
-    float mainX = SIDEBAR_WIDTH + GENERIC_PADDING;
-    float mainWidth = screenWidth - SIDEBAR_WIDTH - GENERIC_PADDING * 2;
+    // -- URL Area --//
+    url_area.x = (side_bar_x + history_sidebar.width);
+    url_area.y = (side_bar_y);
+    url_area.width = (screen_width - history_sidebar.width) * 0.9;
+    url_area.height = (screen_height) * 0.1;
 
-    // URL input box - leave space for SEND button on the right
-    Rectangle urlBox = {
-      mainX,
-      GENERIC_PADDING,
-      mainWidth - SEND_BUTTON_WIDTH - GENERIC_PADDING,
-      URL_INPUT_HEIGHT
-    };
+    url_text_bounds.x = url_area.x + padding;
+    url_text_bounds.y = (url_area.height) / 2;
+    url_text_bounds.width = 7 * (TEXT_SIZE / 2);
+    url_text_bounds.height = TEXT_SIZE * 2;
 
-    // SEND button positioned beside URL input
-    Rectangle sendButton = {
-      urlBox.x + urlBox.width + GENERIC_PADDING,
-      GENERIC_PADDING,
-      SEND_BUTTON_WIDTH,
-      SEND_BUTTON_HEIGHT
-    };
+    url_input_bounds.x = url_text_bounds.x + url_text_bounds.width + padding;
+    url_input_bounds.y = (url_area.height) / 2;
+    url_input_bounds.width = (url_area.width - padding) * 0.7;
+    url_input_bounds.height = TEXT_SIZE * 2;
+
+    url_enter_button.x = url_input_bounds.x + url_input_bounds.width + padding;
+    url_enter_button.y = (url_area.height) / 2;
+    url_enter_button.width = (url_area.width - padding) * 0.1;
+    url_enter_button.height = TEXT_SIZE * 2;
 
-    // Method dropdown below URL
-    Rectangle methodButton = {
-      mainX,
-      urlBox.y + urlBox.height + GENERIC_PADDING,
-      METHOD_BUTTON_WIDTH,
-      METHOD_BUTTON_HEIGHT
-    };
-
-    float tabHeight = 30;
-    float contentY = methodButton.y + methodButton.height + GENERIC_PADDING + tabHeight;
-    float contentHeight = screenHeight - contentY - GENERIC_PADDING;
-
-    float panelWidth = (mainWidth - GENERIC_PADDING) / 2;
+    // -- Input Area --//
+    input_area.x = (side_bar_x + history_sidebar.width);
+    input_area.y = (side_bar_y + url_area.height);
+    input_area.width = url_area.width * 0.5;
+    input_area.height = screen_height - url_area.height;
 
-    Rectangle tabBar = {
-      mainX,
-      methodButton.y + methodButton.height + GENERIC_PADDING,
-      panelWidth,
-      tabHeight
-    };
+    input_tab.x = (side_bar_x + history_sidebar.width) + padding;
+    input_tab.y = (side_bar_y + url_area.height) + padding;
+    input_tab.width = url_area.width * 0.49 - padding;
+    input_tab.height = input_area.height * 0.1;
+    for (int pos = 0; pos < 4; pos++)
+    {
+      input_tab_items[pos].rectangle = input_tab;
+      input_tab_items[pos].rectangle.x = input_tab.x + (pos * input_tab.width / 4);
+      input_tab_items[pos].rectangle.width = input_tab.width / 4;
+    }
 
-    Rectangle requestPanel = {
-      mainX,
-      contentY,
-      panelWidth,
-      contentHeight
-    };
+    input_body.x = input_tab.x;
+    input_body.y = input_tab.y + input_tab.height;
+    input_body.width = url_area.width * 0.49 - padding;
+    input_body.height = input_area.height - input_tab.height - padding;
 
-    Rectangle responsePanel = {
-      mainX + panelWidth + GENERIC_PADDING,
-      contentY,
-      panelWidth,
-      contentHeight
-    };
+    // -- Result Area --//
+    result_area.x = (input_area.x + input_area.width);
+    result_area.y = (side_bar_y + url_area.height);
+    result_area.width = url_area.width * 0.49;
+    result_area.height = screen_height - url_area.height;
+
+    result_body.x = result_area.x + padding;
+    result_body.y = result_area.y + input_tab.height + padding;
+    result_body.width = url_area.width * 0.49 - padding;
+    result_body.height = result_area.height - input_tab.height - padding;
 
     BeginDrawing();
       ClearBackground(GetColor(GuiGetStyle(DEFAULT, BACKGROUND_COLOR)));
 
-      // --- Sidebar Component---
-      DrawRectangleRec(sidebar, Fade(GRAY, 0.1f));
-      GuiGroupBox(sidebar, "HISTORY");
-
-      Rectangle refreshBtn = { 
-        sidebar.x + SIDEBAR_PADDING_GENERAL, 
-        sidebar.y + SIDEBAR_PADDING_GENERAL,
-        SIDEBAR_REFERSH_BUTTON_WIDTH,
-        SIDEBAR_REFERSH_BUTTON_HEIGHT
-      };
-      if (GuiButton(refreshBtn, "Refresh"))
-      {
-        historyCount = PostDog_HistoryDistory_ItemsLoad(historyItems, MAX_HISTORY_ITEMS);
-      }
-
-      Rectangle historyArea = { 
-        sidebar.x + SIDEBAR_PADDING_GENERAL,
-        sidebar.y + SIDEBAR_AREA_PADDING_Y, 
-        sidebar.width - SIDEBAR_AREA_PADDING_X, 
-        sidebar.height - SIDEBAR_AREA_PADDING_Y
-      };
-      if (CheckCollisionPointRec(GetMousePosition(), historyArea))
-      {
-        float wheel = GetMouseWheelMove();
-        historyScroll.y += wheel * 20;
-        if (historyScroll.y < 0) historyScroll.y = 0;
-      }
-
-      BeginScissorMode(historyArea.x, historyArea.y, historyArea.width, historyArea.height);
-
-      if (historyCount == 0)
-      {
-        DrawText("No requests yet", historyArea.x + 5, historyArea.y + 25, 10, DARKGRAY);
-      } 
-      else
-      {
-        int item_y_position = historyArea.y + SIDEBAR_AREA_PADDING_Y + 5 - (int)historyScroll.y;
-        for (
-            int current_history_item_number = 0;
-            current_history_item_number < historyCount;
-            current_history_item_number++
-        )
-        {
-          if (item_y_position > historyArea.y - SIDEBAR_HISTORY_ITEM_HEIGHT && item_y_position < historyArea.y + historyArea.height)
-          {
-            Rectangle itemRect = { historyArea.x, item_y_position, historyArea.width, SIDEBAR_HISTORY_ITEM_HEIGHT - 2 };
-
-            // Draw button for history item
-            Color bgColor = (selectedHistoryIndex == current_history_item_number) ? Fade(BLUE, 0.3f) : Fade(LIGHTGRAY, 0.5f);
-            if (CheckCollisionPointRec(GetMousePosition(), itemRect) && IsMouseButtonPressed(MOUSE_LEFT_BUTTON))
-            {
-              // TODO: This is cringe as fuck probably should just have a strucut that we assign and then zero out lol
-              char tempUrl[1024], tempMethod[16], tempHeaders[HEADER_INPUT_BUFFER_LEN], tempBody[JSON_INPUT_BUFFER_LEN];
-
-              if (PostDog_HistoryDirectory_LoadRequest(
-                    historyItems[current_history_item_number].filename, tempUrl, tempMethod, tempHeaders, tempBody) == 0)
-              {
-                strncpy(urlInput, tempUrl, sizeof(urlInput) - 1);
-                strncpy(headersInput, tempHeaders, sizeof(headersInput) - 1);
-                strncpy(jsonInput, tempBody, sizeof(jsonInput) - 1);
-
-                // Set method
-                for (int m = 0; m < 4; m++)
-                {
-                  if (strcmp(methods[m], tempMethod) == 0)
-                  {
-                    methodActive = m;
-                    break;
-                  }
-                }
-
-                selectedHistoryIndex = current_history_item_number;
-                strcpy(responseText, "Request loaded from history. Click SEND to execute.");
-              }
-            }
-
-            DrawRectangleRec(itemRect, bgColor);
-            DrawRectangleLinesEx(itemRect, 1, GRAY);
-
-            // Draw method badge
-            DrawText(historyItems[current_history_item_number].method, itemRect.x + 5, item_y_position + 5, 10, BLACK);
+      // Sidebar Rect
+      DrawRectangleRec(history_sidebar, Fade(GRAY, 0.1f));
 
-            // Draw timestamp (date only)
-            char dateStr[16] = "";
-            if (strlen(historyItems[current_history_item_number].filename) >= 8)
-            {
-              snprintf(dateStr, sizeof(dateStr), "%.4s-%.2s-%.2s",
-                       historyItems[current_history_item_number].filename, historyItems[current_history_item_number].filename + 4, historyItems[current_history_item_number].filename + 6);
-            }
-            DrawText(dateStr, itemRect.x + 5, item_y_position + 18, 8, DARKGRAY);
-
-            // Draw time
-            char timeStr[16] = "";
-            if (strlen(historyItems[current_history_item_number].filename) >= 15) {
-              snprintf(timeStr, sizeof(timeStr), "%.2s:%.2s:%.2s",
-                       historyItems[current_history_item_number].filename + 9, historyItems[current_history_item_number].filename + 11, historyItems[current_history_item_number].filename + 13);
-            }
-            DrawText(timeStr, itemRect.x + 5, item_y_position + 28, 8, DARKGRAY);
-          }
-
-          item_y_position += SIDEBAR_HISTORY_ITEM_HEIGHT;
-        }
-      }
-
-      EndScissorMode();
-
-      // --- URL Input Component ---
-      GuiLabel((Rectangle){ mainX, GENERIC_PADDING - 15, 100, 20 }, "URL:");
-      if (GuiTextBox(urlBox, urlInput, 1024, urlEditMode))
-      {
-        urlEditMode = !urlEditMode;
-      }
-      if (urlEditMode && (IsKeyDown(KEY_LEFT_SUPER) || IsKeyDown(KEY_LEFT_CONTROL)) && IsKeyPressed(KEY_C))
-      {
-        SetClipboardText(urlInput);
-      }
-
-      // Send button (beside URL)
-      if (GuiButton(sendButton, "SEND") || (urlEditMode && IsKeyDown(KEY_ENTER)))
-      {
-        strcpy(responseText, "Sending request...\n");
-
-        // Make the actual HTTP request
-        char tempResponse[16384];
-        const char *selectedMethod = methods[methodActive];
-
-        // Use JSON body for POST/PUT, otherwise use empty body
-        const char *requestBody = (methodActive == 1 || methodActive == 2) ? jsonInput : NULL;
-        const char *requestHeaders = headersInput;
-
-        // Save request to history
-        Postdog_SaveRequestToHistory(urlInput, selectedMethod, requestHeaders, requestBody);
-
-        // Reload history to show the new request
-        historyCount = PostDog_HistoryDistory_ItemsLoad(historyItems, MAX_HISTORY_ITEMS);
-
-        // Making the requests.
-        PostDog_Make_HttpRequest(urlInput, selectedMethod, requestHeaders,
-                       requestBody, tempResponse, sizeof(tempResponse));
-        strncpy(responseText, tempResponse, sizeof(responseText) - 1);
-        responseText[sizeof(responseText) - 1] = '\0';
-      }
-
-      // Tab toggle (3 tabs now)
-      float tabWidth = tabBar.width / 3;
-      Rectangle jsonTab = { tabBar.x, tabBar.y - 10, tabWidth, tabBar.height };
-      Rectangle headersTab = { tabBar.x + tabWidth, tabBar.y - 10, tabWidth, tabBar.height };
-      Rectangle paramsTab = { tabBar.x + tabWidth * 2, tabBar.y - 10, tabWidth, tabBar.height };
-
-      if (GuiButton(jsonTab, activeTab ==  ActiveTab_JSON ? "#191#Body" : "Body"))
-      {
-        activeTab = ActiveTab_JSON;
-      }
-
-      if (GuiButton(headersTab, activeTab == ActiveTab_Headers ? "#191#Headers" : "Headers"))
-      {
-        activeTab = ActiveTab_Headers;
-      }
-
-      if (GuiButton(paramsTab, activeTab == ActiveTab_Params ? "#191#Params" : "Params"))
-      {
-        activeTab = ActiveTab_Params;
-      }
+      // URL area Rect
+      GuiDrawText("URL: ", url_text_bounds, TEXT_ALIGN_CENTER, RED); 
+      DrawRectangleRec(url_area, Fade(RED, 0.1f));
+      GuiTextBox(url_input_bounds, input_text, 1024 * 4, true);
+      sendRequest = GuiButton(url_enter_button, "ENTER");
 
-      const char *panelTitle;
-      switch(activeTab) {
-        case  ActiveTab_JSON:
-        {
-          panelTitle = "Request Body (JSON)";
-          break;
-        }
-        case  ActiveTab_Headers:
-        {
-          panelTitle = "Request Headers";
-          break;
-        } 
-        case  ActiveTab_Params:
-        {
-          panelTitle = "Query Parameters";
-          break;
-        }
-      }
-
-      // Panel title
-      GuiGroupBox(requestPanel, panelTitle);
-      Rectangle textArea = {
-        requestPanel.x + 10,
-        requestPanel.y + 30,
-        requestPanel.width - 20,
-        requestPanel.height - 40
-      };
-
-      // Handle click outside to disable edit mode
-      if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON))
-      {
-        if (!CheckCollisionPointRec(GetMousePosition(), textArea))
-        {
-          jsonEditMode = false;
-          headersEditMode = false;
-          paramsEditMode = false;
-        }
-      }
-
-      // Draw border for text area
-      DrawRectangleLinesEx(textArea, 1, GRAY);
-
-      // Manual scroll handling with mouse wheel
-      if (CheckCollisionPointRec(GetMousePosition(), textArea))
-      {
-        float wheel = GetMouseWheelMove();
-        switch(activeTab)
-        {
-          case  ActiveTab_JSON:
-          {
-            jsonScroll.y += wheel * 20;
-            if (jsonScroll.y < 0) jsonScroll.y = 0;
-          }
-          case  ActiveTab_Headers:
-          {
-            headersScroll.y += wheel * 20;
-            if (headersScroll.y < 0) headersScroll.y = 0;
-          } 
-          case  ActiveTab_Params:
-          {
-            paramsScroll.y += wheel * 20;
-            if (paramsScroll.y < 0) paramsScroll.y = 0;
-          }
-        }
-      }
-
-      char *copyFromInput;
-      bool *currentMode; 
-      switch(activeTab)
+      // Input Tabs Rect
+      DrawRectangleRec(input_area, Fade(BLUE, 0.1f));
+      DrawRectangleRec(input_tab,  Fade(DARKBLUE, 0.1f));
+      for (int pos = 0; pos < 4; pos++)
       {
-        case  ActiveTab_JSON:
-        {
-          PostDog_Render_TextWithScroll(textArea, jsonScroll, jsonInput);
-          copyFromInput = jsonInput;
-          currentMode = &jsonEditMode;
-          break;
-        }
-        case  ActiveTab_Headers:
-        {
-          PostDog_Render_TextWithScroll(textArea, headersScroll, headersInput);
-          copyFromInput = headersInput;
-          currentMode = &headersEditMode;
-          break;
-        } 
-        case  ActiveTab_Params:
-        {
-          PostDog_Render_TextWithScroll(textArea, paramsScroll, paramsInput);
-          copyFromInput = paramsInput;
-          currentMode = &paramsEditMode;
-
-          Rectangle updateUrlBtn = { textArea.x + 30, textArea.y + textArea.height - 10, 120, 20 };
-          // TODO: Automatic update
-          if (GuiButton(updateUrlBtn, "Update URL"))
-          {
-            char tempUrl[1024];
-            strncpy(tempUrl, urlInput, sizeof(tempUrl) - 1);
-
-            // Remove existing params if any
-            char *questionMark = strchr(tempUrl, '?');
-            if (questionMark) *questionMark = '\0';
-
-            Postdog_UpdateUrlWithParams(urlInput, sizeof(urlInput), tempUrl, paramsInput);
-          }
-          break;
-        }
+        JUNE_GuiButton(input_tab_items[pos].rectangle, input_tab_items[pos].label, 0, Fade(DARKBLUE, 0.1f)); 
       }
-
-      if ((IsKeyDown(KEY_LEFT_SUPER) || IsKeyDown(KEY_LEFT_CONTROL)) && IsKeyPressed(KEY_C))
-      {
-        SetClipboardText(copyFromInput);
-      }
-
-      Rectangle editBtn = { textArea.x + textArea.width - 60, textArea.y + textArea.height - 10, 50, 20 };
-      if (GuiButton(editBtn, "Edit"))
-      {
-        *currentMode = !(*currentMode);
-      }
-
-      // Response Panel with scroll
-      GuiGroupBox(responsePanel, "Response");
+      JUNE_GuiTextBox(input_body, input_text, 1024 * 4, true);
 
-      Rectangle responseArea = {
-        responsePanel.x + 10,
-        responsePanel.y + 30,
-        responsePanel.width - 20,
-        responsePanel.height - 40
-      };
-
-      // Manual scroll for response
-      if (CheckCollisionPointRec(GetMousePosition(), responseArea))
-      {
-        float wheel = GetMouseWheelMove();
-        responseScroll.y += wheel * 20;
-        if (responseScroll.y < 0) responseScroll.y = 0;
-      }
-
-      // Draw border
-      DrawRectangleLinesEx(responseArea, 1, GRAY);
-
-      // Draw response text with scroll
-      PostDog_Render_TextWithScroll(responseArea, responseScroll, responseText);
-
-      if ((IsKeyDown(KEY_LEFT_SUPER) || IsKeyDown(KEY_LEFT_CONTROL)) && IsKeyPressed(KEY_C))
-      {
-        if (CheckCollisionPointRec(GetMousePosition(), responseArea)) {
-          SetClipboardText(responseText);
-        }
-      }
-
-      // ---  Edit modal  ----
-      if (jsonEditMode)
-      {
-        GuiTextBox(
-            (Rectangle){ screenWidth/2 - 300, screenHeight/2 - 200, 600, 400 },
-            jsonInput, JSON_INPUT_BUFFER_LEN, true);
-      }
-
-      if (headersEditMode)
-      {
-        GuiTextBox(
-            (Rectangle){ screenWidth/2 - 300, screenHeight/2 - 200, 600, 400 },
-            headersInput, HEADER_INPUT_BUFFER_LEN, true);
-      }
-
-      if (paramsEditMode)
-      {
-        GuiTextBox(
-            (Rectangle){ screenWidth/2 - 300, screenHeight/2 - 200, 600, 400 },
-            paramsInput, PARAM_INPUT_BUFFER_LEN, true);
-      }
-
-      if (GuiDropdownBox(methodButton, "GET;POST;PUT;DELETE", &methodActive, methodDropdown))
-      {
-        methodDropdown = !methodDropdown;
-      }
-
-
+      // Result Rect
+      DrawRectangleRec(result_area, Fade(GREEN, 0.1f));
+      DrawRectangleRec(result_body, Fade(DARKGREEN, 0.1f));
     EndDrawing();
   }
-
   CloseWindow();
   return 0;
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/previous.c	Sun Jan 04 06:39:16 2026 -0800
@@ -0,0 +1,447 @@
+  char urlInput[1024] = "https://httpbin.org/get";
+  bool urlEditMode = false;
+
+  char jsonInput[JSON_INPUT_BUFFER_LEN] = "{\"key\":\"value\"}";
+  bool jsonEditMode = false;
+
+  char headersInput[HEADER_INPUT_BUFFER_LEN] = "Content-Type: application/json";
+  bool headersEditMode = false;
+
+  char responseText[16384] = "Response will appear here...\n\nTry the default URL or enter your own!";
+
+  char paramsInput[PARAM_INPUT_BUFFER_LEN] = "key1=value1\nkey2=value2";
+  bool paramsEditMode = false;
+
+  ActiveTab activeTab = ActiveTab_JSON; // 0 = JSON, 1 = Headers, 2 = Params
+
+  // HTTP method selection
+  int methodActive = 0;
+  bool methodDropdown = false;
+  const char *methods[] = { "GET", "POST", "PUT", "DELETE" };
+
+  // Scroll support
+  Vector2 jsonScroll = { 0, 0 };
+  Vector2 headersScroll = { 0, 0 };
+  Vector2 paramsScroll = { 0, 0 };
+  Vector2 responseScroll = { 0, 0 };
+  Vector2 historyScroll = { 0, 0 };
+
+  // History
+  HistoryItem historyItems[MAX_HISTORY_ITEMS];
+  int historyCount = 0;
+  int selectedHistoryIndex = -1;
+
+  // Load initial history
+  historyCount = PostDog_HistoryDistory_ItemsLoad(historyItems, MAX_HISTORY_ITEMS);
+
+  while (!WindowShouldClose())
+  {
+    // Get current window dimensions for responsive layout
+    int screenWidth = GetScreenWidth();
+    int screenHeight = GetScreenHeight();
+
+    // Layout calculations
+    Rectangle sidebar = { 0, 10, SIDEBAR_WIDTH, screenHeight };
+
+    float mainX = SIDEBAR_WIDTH + GENERIC_PADDING;
+    float mainWidth = screenWidth - SIDEBAR_WIDTH - GENERIC_PADDING * 2;
+
+    // URL input box - leave space for SEND button on the right
+    Rectangle urlBox = {
+      mainX,
+      GENERIC_PADDING,
+      mainWidth - SEND_BUTTON_WIDTH - GENERIC_PADDING,
+      URL_INPUT_HEIGHT
+    };
+
+    // SEND button positioned beside URL input
+    Rectangle sendButton = {
+      urlBox.x + urlBox.width + GENERIC_PADDING,
+      GENERIC_PADDING,
+      SEND_BUTTON_WIDTH,
+      SEND_BUTTON_HEIGHT
+    };
+
+    // Method dropdown below URL
+    Rectangle methodButton = {
+      mainX,
+      urlBox.y + urlBox.height + GENERIC_PADDING,
+      METHOD_BUTTON_WIDTH,
+      METHOD_BUTTON_HEIGHT
+    };
+
+    float tabHeight = 30;
+    float contentY = methodButton.y + methodButton.height + GENERIC_PADDING + tabHeight;
+    float contentHeight = screenHeight - contentY - GENERIC_PADDING;
+
+    float panelWidth = (mainWidth - GENERIC_PADDING) / 2;
+
+    Rectangle tabBar = {
+      mainX,
+      methodButton.y + methodButton.height + GENERIC_PADDING,
+      panelWidth,
+      tabHeight
+    };
+
+    Rectangle requestPanel = {
+      mainX,
+      contentY,
+      panelWidth,
+      contentHeight
+    };
+
+    Rectangle responsePanel = {
+      mainX + panelWidth + GENERIC_PADDING,
+      contentY,
+      panelWidth,
+      contentHeight
+    };
+
+    BeginDrawing();
+      ClearBackground(GetColor(GuiGetStyle(DEFAULT, BACKGROUND_COLOR)));
+
+      // --- Sidebar Component---
+      DrawRectangleRec(sidebar, Fade(GRAY, 0.1f));
+      GuiGroupBox(sidebar, "HISTORY");
+
+      Rectangle refreshBtn = { 
+        sidebar.x + SIDEBAR_PADDING_GENERAL, 
+        sidebar.y + SIDEBAR_PADDING_GENERAL,
+        SIDEBAR_REFERSH_BUTTON_WIDTH,
+        SIDEBAR_REFERSH_BUTTON_HEIGHT
+      };
+      if (GuiButton(refreshBtn, "Refresh"))
+      {
+        historyCount = PostDog_HistoryDistory_ItemsLoad(historyItems, MAX_HISTORY_ITEMS);
+      }
+
+      Rectangle historyArea = { 
+        sidebar.x + SIDEBAR_PADDING_GENERAL,
+        sidebar.y + SIDEBAR_AREA_PADDING_Y, 
+        sidebar.width - SIDEBAR_AREA_PADDING_X, 
+        sidebar.height - SIDEBAR_AREA_PADDING_Y
+      };
+      if (CheckCollisionPointRec(GetMousePosition(), historyArea))
+      {
+        float wheel = GetMouseWheelMove();
+        historyScroll.y += wheel * 20;
+        if (historyScroll.y < 0) historyScroll.y = 0;
+      }
+
+      BeginScissorMode(historyArea.x, historyArea.y, historyArea.width, historyArea.height);
+
+      if (historyCount == 0)
+      {
+        DrawText("No requests yet", historyArea.x + 5, historyArea.y + 25, 10, DARKGRAY);
+      } 
+      else
+      {
+        int item_y_position = historyArea.y + SIDEBAR_AREA_PADDING_Y + 5 - (int)historyScroll.y;
+        for (
+            int current_history_item_number = 0;
+            current_history_item_number < historyCount;
+            current_history_item_number++
+        )
+        {
+          if (item_y_position > historyArea.y - SIDEBAR_HISTORY_ITEM_HEIGHT && item_y_position < historyArea.y + historyArea.height)
+          {
+            Rectangle itemRect = { historyArea.x, item_y_position, historyArea.width, SIDEBAR_HISTORY_ITEM_HEIGHT - 2 };
+
+            // Draw button for history item
+            Color bgColor = (selectedHistoryIndex == current_history_item_number) ? Fade(BLUE, 0.3f) : Fade(LIGHTGRAY, 0.5f);
+            if (CheckCollisionPointRec(GetMousePosition(), itemRect) && IsMouseButtonPressed(MOUSE_LEFT_BUTTON))
+            {
+              // TODO: This is cringe as fuck probably should just have a strucut that we assign and then zero out lol
+              char tempUrl[1024], tempMethod[16], tempHeaders[HEADER_INPUT_BUFFER_LEN], tempBody[JSON_INPUT_BUFFER_LEN];
+
+              if (PostDog_HistoryDirectory_LoadRequest(
+                    historyItems[current_history_item_number].filename, tempUrl, tempMethod, tempHeaders, tempBody) == 0)
+              {
+                strncpy(urlInput, tempUrl, sizeof(urlInput) - 1);
+                strncpy(headersInput, tempHeaders, sizeof(headersInput) - 1);
+                strncpy(jsonInput, tempBody, sizeof(jsonInput) - 1);
+
+                // Set method
+                for (int m = 0; m < 4; m++)
+                {
+                  if (strcmp(methods[m], tempMethod) == 0)
+                  {
+                    methodActive = m;
+                    break;
+                  }
+                }
+
+                selectedHistoryIndex = current_history_item_number;
+                strcpy(responseText, "Request loaded from history. Click SEND to execute.");
+              }
+            }
+
+            DrawRectangleRec(itemRect, bgColor);
+            DrawRectangleLinesEx(itemRect, 1, GRAY);
+
+            // Draw method badge
+            DrawText(historyItems[current_history_item_number].method, itemRect.x + 5, item_y_position + 5, 10, BLACK);
+
+            // Draw timestamp (date only)
+            char dateStr[16] = "";
+            if (strlen(historyItems[current_history_item_number].filename) >= 8)
+            {
+              snprintf(dateStr, sizeof(dateStr), "%.4s-%.2s-%.2s",
+                       historyItems[current_history_item_number].filename, historyItems[current_history_item_number].filename + 4, historyItems[current_history_item_number].filename + 6);
+            }
+            DrawText(dateStr, itemRect.x + 5, item_y_position + 18, 8, DARKGRAY);
+
+            // Draw time
+            char timeStr[16] = "";
+            if (strlen(historyItems[current_history_item_number].filename) >= 15) {
+              snprintf(timeStr, sizeof(timeStr), "%.2s:%.2s:%.2s",
+                       historyItems[current_history_item_number].filename + 9, historyItems[current_history_item_number].filename + 11, historyItems[current_history_item_number].filename + 13);
+            }
+            DrawText(timeStr, itemRect.x + 5, item_y_position + 28, 8, DARKGRAY);
+          }
+
+          item_y_position += SIDEBAR_HISTORY_ITEM_HEIGHT;
+        }
+      }
+
+      EndScissorMode();
+
+      // --- URL Input Component ---
+      GuiLabel((Rectangle){ mainX, GENERIC_PADDING - 15, 100, 20 }, "URL:");
+      if (GuiTextBox(urlBox, urlInput, 1024, urlEditMode))
+      {
+        urlEditMode = !urlEditMode;
+      }
+      if (urlEditMode && (IsKeyDown(KEY_LEFT_SUPER) || IsKeyDown(KEY_LEFT_CONTROL)) && IsKeyPressed(KEY_C))
+      {
+        SetClipboardText(urlInput);
+      }
+
+      // Send button (beside URL)
+      if (GuiButton(sendButton, "SEND") || (urlEditMode && IsKeyDown(KEY_ENTER)))
+      {
+        strcpy(responseText, "Sending request...\n");
+
+        // Make the actual HTTP request
+        char tempResponse[16384];
+        const char *selectedMethod = methods[methodActive];
+
+        // Use JSON body for POST/PUT, otherwise use empty body
+        const char *requestBody = (methodActive == 1 || methodActive == 2) ? jsonInput : NULL;
+        const char *requestHeaders = headersInput;
+
+        // Save request to history
+        Postdog_SaveRequestToHistory(urlInput, selectedMethod, requestHeaders, requestBody);
+
+        // Reload history to show the new request
+        historyCount = PostDog_HistoryDistory_ItemsLoad(historyItems, MAX_HISTORY_ITEMS);
+
+        // Making the requests.
+        PostDog_Make_HttpRequest(urlInput, selectedMethod, requestHeaders,
+                       requestBody, tempResponse, sizeof(tempResponse));
+        strncpy(responseText, tempResponse, sizeof(responseText) - 1);
+        responseText[sizeof(responseText) - 1] = '\0';
+      }
+
+      // Tab toggle (3 tabs now)
+      float tabWidth = tabBar.width / 3;
+      Rectangle jsonTab = { tabBar.x, tabBar.y - 10, tabWidth, tabBar.height };
+      Rectangle headersTab = { tabBar.x + tabWidth, tabBar.y - 10, tabWidth, tabBar.height };
+      Rectangle paramsTab = { tabBar.x + tabWidth * 2, tabBar.y - 10, tabWidth, tabBar.height };
+
+      if (GuiButton(jsonTab, activeTab ==  ActiveTab_JSON ? "#191#Body" : "Body"))
+      {
+        activeTab = ActiveTab_JSON;
+      }
+
+      if (GuiButton(headersTab, activeTab == ActiveTab_Headers ? "#191#Headers" : "Headers"))
+      {
+        activeTab = ActiveTab_Headers;
+      }
+
+      if (GuiButton(paramsTab, activeTab == ActiveTab_Params ? "#191#Params" : "Params"))
+      {
+        activeTab = ActiveTab_Params;
+      }
+
+      const char *panelTitle;
+      switch(activeTab) {
+        case  ActiveTab_JSON:
+        {
+          panelTitle = "Request Body (JSON)";
+          break;
+        }
+        case  ActiveTab_Headers:
+        {
+          panelTitle = "Request Headers";
+          break;
+        } 
+        case  ActiveTab_Params:
+        {
+          panelTitle = "Query Parameters";
+          break;
+        }
+      }
+
+      // Panel title
+      GuiGroupBox(requestPanel, panelTitle);
+      Rectangle textArea = {
+        requestPanel.x + 10,
+        requestPanel.y + 30,
+        requestPanel.width - 20,
+        requestPanel.height - 40
+      };
+
+      // Handle click outside to disable edit mode
+      if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON))
+      {
+        if (!CheckCollisionPointRec(GetMousePosition(), textArea))
+        {
+          jsonEditMode = false;
+          headersEditMode = false;
+          paramsEditMode = false;
+        }
+      }
+
+      // Draw border for text area
+      DrawRectangleLinesEx(textArea, 1, GRAY);
+
+      // Manual scroll handling with mouse wheel
+      if (CheckCollisionPointRec(GetMousePosition(), textArea))
+      {
+        float wheel = GetMouseWheelMove();
+        switch(activeTab)
+        {
+          case  ActiveTab_JSON:
+          {
+            jsonScroll.y += wheel * 20;
+            if (jsonScroll.y < 0) jsonScroll.y = 0;
+          }
+          case  ActiveTab_Headers:
+          {
+            headersScroll.y += wheel * 20;
+            if (headersScroll.y < 0) headersScroll.y = 0;
+          } 
+          case  ActiveTab_Params:
+          {
+            paramsScroll.y += wheel * 20;
+            if (paramsScroll.y < 0) paramsScroll.y = 0;
+          }
+        }
+      }
+
+      char *copyFromInput;
+      bool *currentMode; 
+      switch(activeTab)
+      {
+        case  ActiveTab_JSON:
+        {
+          PostDog_Render_TextWithScroll(textArea, jsonScroll, jsonInput);
+          copyFromInput = jsonInput;
+          currentMode = &jsonEditMode;
+          break;
+        }
+        case  ActiveTab_Headers:
+        {
+          PostDog_Render_TextWithScroll(textArea, headersScroll, headersInput);
+          copyFromInput = headersInput;
+          currentMode = &headersEditMode;
+          break;
+        } 
+        case  ActiveTab_Params:
+        {
+          PostDog_Render_TextWithScroll(textArea, paramsScroll, paramsInput);
+          copyFromInput = paramsInput;
+          currentMode = &paramsEditMode;
+
+          Rectangle updateUrlBtn = { textArea.x + 30, textArea.y + textArea.height - 10, 120, 20 };
+          // TODO: Automatic update
+          if (GuiButton(updateUrlBtn, "Update URL"))
+          {
+            char tempUrl[1024];
+            strncpy(tempUrl, urlInput, sizeof(tempUrl) - 1);
+
+            // Remove existing params if any
+            char *questionMark = strchr(tempUrl, '?');
+            if (questionMark) *questionMark = '\0';
+
+            Postdog_UpdateUrlWithParams(urlInput, sizeof(urlInput), tempUrl, paramsInput);
+          }
+          break;
+        }
+      }
+
+      if ((IsKeyDown(KEY_LEFT_SUPER) || IsKeyDown(KEY_LEFT_CONTROL)) && IsKeyPressed(KEY_C))
+      {
+        SetClipboardText(copyFromInput);
+      }
+
+      Rectangle editBtn = { textArea.x + textArea.width - 60, textArea.y + textArea.height - 10, 50, 20 };
+      if (GuiButton(editBtn, "Edit"))
+      {
+        *currentMode = !(*currentMode);
+      }
+
+      // Response Panel with scroll
+      GuiGroupBox(responsePanel, "Response");
+
+      Rectangle responseArea = {
+        responsePanel.x + 10,
+        responsePanel.y + 30,
+        responsePanel.width - 20,
+        responsePanel.height - 40
+      };
+
+      // Manual scroll for response
+      if (CheckCollisionPointRec(GetMousePosition(), responseArea))
+      {
+        float wheel = GetMouseWheelMove();
+        responseScroll.y += wheel * 20;
+        if (responseScroll.y < 0) responseScroll.y = 0;
+      }
+
+      // Draw border
+      DrawRectangleLinesEx(responseArea, 1, GRAY);
+
+      // Draw response text with scroll
+      PostDog_Render_TextWithScroll(responseArea, responseScroll, responseText);
+
+      if ((IsKeyDown(KEY_LEFT_SUPER) || IsKeyDown(KEY_LEFT_CONTROL)) && IsKeyPressed(KEY_C))
+      {
+        if (CheckCollisionPointRec(GetMousePosition(), responseArea)) {
+          SetClipboardText(responseText);
+        }
+      }
+
+      // ---  Edit modal  ----
+      if (jsonEditMode)
+      {
+        GuiTextBox(
+            (Rectangle){ screenWidth/2 - 300, screenHeight/2 - 200, 600, 400 },
+            jsonInput, JSON_INPUT_BUFFER_LEN, true);
+      }
+
+      if (headersEditMode)
+      {
+        GuiTextBox(
+            (Rectangle){ screenWidth/2 - 300, screenHeight/2 - 200, 600, 400 },
+            headersInput, HEADER_INPUT_BUFFER_LEN, true);
+      }
+
+      if (paramsEditMode)
+      {
+        GuiTextBox(
+            (Rectangle){ screenWidth/2 - 300, screenHeight/2 - 200, 600, 400 },
+            paramsInput, PARAM_INPUT_BUFFER_LEN, true);
+      }
+
+      if (GuiDropdownBox(methodButton, "GET;POST;PUT;DELETE", &methodActive, methodDropdown))
+      {
+        methodDropdown = !methodDropdown;
+      }
+
+
+    EndDrawing();
+  }
+
+
--- a/seobeo/os/s_linux_edge.c	Sat Jan 03 21:16:17 2026 -0800
+++ b/seobeo/os/s_linux_edge.c	Sun Jan 04 06:39:16 2026 -0800
@@ -77,7 +77,8 @@
   pthread_attr_setstacksize(&attr, 5 * 1024 * 1024); // 5 MB
 
   pthread_t threads[thread_count];
-  for (int i = 0; i < thread_count; i++) {
+  for (int i = 0; i < thread_count; i++)
+  {
     WorkerArgs *args = malloc(sizeof(WorkerArgs));
     *args = (WorkerArgs){ p_server_handle, p_html_cache };
 
@@ -85,9 +86,8 @@
   }
 
   // Join threads instead of detaching for proper cleanup
-  for (int i = 0; i < thread_count; i++) {
+  for (int i = 0; i < thread_count; i++)
     pthread_join(threads[i], NULL);
-  }
 
   pthread_attr_destroy(&attr);
 }
--- a/third_party/raylib/include/raygui.h	Sat Jan 03 21:16:17 2026 -0800
+++ b/third_party/raylib/include/raygui.h	Sun Jan 04 06:39:16 2026 -0800
@@ -316,7 +316,7 @@
 *
 *   LICENSE: zlib/libpng
 *
-*   Copyright (c) 2014-2025 Ramon Santamaria (@raysan5)
+*   Copyright (c) 2014-2026 Ramon Santamaria (@raysan5)
 *
 *   This software is provided "as-is", without any express or implied warranty. In no event
 *   will the authors be held liable for any damages arising from the use of this software.
@@ -2506,58 +2506,23 @@
     int result = 0;
     GuiState state = guiState;
 
-    bool multiline = true; // TODO: Consider multiline text input
+    bool multiline = false; // TODO: Consider multiline text input
     int wrapMode = GuiGetStyle(DEFAULT, TEXT_WRAP_MODE);
 
     Rectangle textBounds = GetTextBounds(TEXTBOX, bounds);
     int textLength = (text != NULL)? (int)strlen(text) : 0; // Get current text length
     int thisCursorIndex = textBoxCursorIndex;
     if (thisCursorIndex > textLength) thisCursorIndex = textLength;
-
-    // Calculate cursor position for multiline
-    int cursorLine = 0;  // Current line number (0-based)
-    int lineStart = 0;   // Start index of current line
-
-    if (multiline)
-    {
-        // Count newlines before cursor to determine line number
-        for (int i = 0; i < thisCursorIndex; i++)
-        {
-            if (text[i] == '\n')
-            {
-                cursorLine++;
-                lineStart = i + 1;
-            }
-        }
-    }
-
-    // Calculate horizontal position within current line
-    char lineText[1024] = { 0 };
-    int lineTextLen = 0;
-    if (multiline)
-    {
-        // Extract current line text up to cursor
-        int i = lineStart;
-        while (i < thisCursorIndex && text[i] != '\n' && lineTextLen < 1023)
-        {
-            lineText[lineTextLen++] = text[i++];
-        }
-        lineText[lineTextLen] = '\0';
-    }
-
-    int textWidth = multiline ? GuiGetTextWidth(lineText) : (GuiGetTextWidth(text) - GuiGetTextWidth(text + thisCursorIndex));
+    int textWidth = GuiGetTextWidth(text) - GuiGetTextWidth(text + thisCursorIndex);
     int textIndexOffset = 0; // Text index offset to start drawing in the box
 
-    // Line height for multiline (matches GuiDrawText line spacing)
-    int lineHeight = GuiGetStyle(DEFAULT, TEXT_SIZE);
-
     // Cursor rectangle
-    // NOTE: Position X and Y values updated for multiline support
+    // NOTE: Position X value should be updated
     Rectangle cursor = {
         textBounds.x + textWidth + GuiGetStyle(DEFAULT, TEXT_SPACING),
-        multiline ? (textBounds.y + cursorLine * lineHeight) : (textBounds.y + textBounds.height/2 - GuiGetStyle(DEFAULT, TEXT_SIZE)),
+        textBounds.y + textBounds.height/2 - GuiGetStyle(DEFAULT, TEXT_SIZE),
         2,
-        (float)GuiGetStyle(DEFAULT, TEXT_SIZE)
+        (float)GuiGetStyle(DEFAULT, TEXT_SIZE)*2
     };
 
     if (cursor.height >= bounds.height) cursor.height = bounds.height - GuiGetStyle(TEXTBOX, BORDER_WIDTH)*2;
@@ -2853,66 +2818,6 @@
                 textBoxCursorIndex += nextCodepointSize;
             }
 
-            // Vertical cursor movement for multiline
-            if (multiline && (IsKeyPressed(KEY_UP) || (IsKeyDown(KEY_UP) && autoCursorShouldTrigger)))
-            {
-                // Find start of current line
-                int currentLineStart = textBoxCursorIndex;
-                while (currentLineStart > 0 && text[currentLineStart - 1] != '\n') currentLineStart--;
-
-                // Calculate horizontal position in current line
-                int horizontalPos = textBoxCursorIndex - currentLineStart;
-
-                // Find start of previous line
-                if (currentLineStart > 0)
-                {
-                    int prevLineEnd = currentLineStart - 1; // Skip the newline
-                    int prevLineStart = prevLineEnd;
-                    while (prevLineStart > 0 && text[prevLineStart - 1] != '\n') prevLineStart--;
-
-                    // Move to same horizontal position on previous line (or end of line if shorter)
-                    int prevLineLength = prevLineEnd - prevLineStart;
-                    int targetPos = (horizontalPos < prevLineLength) ? horizontalPos : prevLineLength;
-                    textBoxCursorIndex = prevLineStart + targetPos;
-                }
-                else
-                {
-                    // Already on first line, move to start
-                    textBoxCursorIndex = 0;
-                }
-            }
-            else if (multiline && (IsKeyPressed(KEY_DOWN) || (IsKeyDown(KEY_DOWN) && autoCursorShouldTrigger)))
-            {
-                // Find start of current line
-                int currentLineStart = textBoxCursorIndex;
-                while (currentLineStart > 0 && text[currentLineStart - 1] != '\n') currentLineStart--;
-
-                // Calculate horizontal position in current line
-                int horizontalPos = textBoxCursorIndex - currentLineStart;
-
-                // Find end of current line
-                int currentLineEnd = textBoxCursorIndex;
-                while (currentLineEnd < textLength && text[currentLineEnd] != '\n') currentLineEnd++;
-
-                // Find next line
-                if (currentLineEnd < textLength)
-                {
-                    int nextLineStart = currentLineEnd + 1; // Skip the newline
-                    int nextLineEnd = nextLineStart;
-                    while (nextLineEnd < textLength && text[nextLineEnd] != '\n') nextLineEnd++;
-
-                    // Move to same horizontal position on next line (or end of line if shorter)
-                    int nextLineLength = nextLineEnd - nextLineStart;
-                    int targetPos = (horizontalPos < nextLineLength) ? horizontalPos : nextLineLength;
-                    textBoxCursorIndex = nextLineStart + targetPos;
-                }
-                else
-                {
-                    // Already on last line, move to end
-                    textBoxCursorIndex = textLength;
-                }
-            }
-
             // Move cursor position with mouse
             if (CheckCollisionPointRec(mousePosition, textBounds))     // Mouse hover text
             {
@@ -2957,39 +2862,9 @@
             }
             else mouseCursor.x = -1;
 
-            // Recalculate cursor position for multiline
-            if (multiline)
-            {
-                // Recalculate cursor line and position
-                int newCursorLine = 0;
-                int newLineStart = 0;
-
-                for (int i = 0; i < textBoxCursorIndex; i++)
-                {
-                    if (text[i] == '\n')
-                    {
-                        newCursorLine++;
-                        newLineStart = i + 1;
-                    }
-                }
-
-                // Extract current line text up to cursor
-                char currentLineText[1024] = { 0 };
-                int currentLineLen = 0;
-                int i = newLineStart;
-                while (i < textBoxCursorIndex && text[i] != '\n' && currentLineLen < 1023)
-                {
-                    currentLineText[currentLineLen++] = text[i++];
-                }
-                currentLineText[currentLineLen] = '\0';
-
-                cursor.x = bounds.x + GuiGetStyle(TEXTBOX, TEXT_PADDING) + GuiGetTextWidth(currentLineText) + GuiGetStyle(DEFAULT, TEXT_SPACING);
-                cursor.y = textBounds.y + (newCursorLine * lineHeight * 1.5);
-            }
-            else
-            {
-                cursor.x = bounds.x + GuiGetStyle(TEXTBOX, TEXT_PADDING) + GuiGetTextWidth(text + textIndexOffset) - GuiGetTextWidth(text + textBoxCursorIndex) + GuiGetStyle(DEFAULT, TEXT_SPACING);
-            }
+            // Recalculate cursor position.y depending on textBoxCursorIndex
+            cursor.x = bounds.x + GuiGetStyle(TEXTBOX, TEXT_PADDING) + GuiGetTextWidth(text + textIndexOffset) - GuiGetTextWidth(text + textBoxCursorIndex) + GuiGetStyle(DEFAULT, TEXT_SPACING);
+            // if (multiline) GetTextLines(text, &cursor.y);
 
             // Finish text editing on ENTER or mouse click outside bounds
             if ((!multiline && IsKeyPressed(KEY_ENTER)) ||
@@ -3031,15 +2906,8 @@
 
     // Draw text considering index offset if required
     // NOTE: Text index offset depends on cursor position
-    // Set vertical alignment to top for multiline
-    int prevVerticalAlignment = GuiGetStyle(DEFAULT, TEXT_ALIGNMENT_VERTICAL);
-    if (multiline) GuiSetStyle(DEFAULT, TEXT_ALIGNMENT_VERTICAL, TEXT_ALIGN_TOP);
-
     GuiDrawText(text + textIndexOffset, textBounds, GuiGetStyle(TEXTBOX, TEXT_ALIGNMENT), GetColor(GuiGetStyle(TEXTBOX, TEXT + (state*3))));
 
-    // Restore previous vertical alignment
-    if (multiline) GuiSetStyle(DEFAULT, TEXT_ALIGNMENT_VERTICAL, prevVerticalAlignment);
-
     // Draw cursor
     if (editMode && !GuiGetStyle(TEXTBOX, TEXT_READONLY))
     {
@@ -4330,9 +4198,6 @@
         GuiSetStyle(LABEL, TEXT_ALIGNMENT, prevTextAlignment);
     }
 
-    int prevTextBoxAlignment = GuiGetStyle(TEXTBOX, TEXT_ALIGNMENT);
-    GuiSetStyle(TEXTBOX, TEXT_ALIGNMENT, TEXT_ALIGN_LEFT);
-
     if (secretViewActive != NULL)
     {
         static char stars[] = "****************";
@@ -4345,7 +4210,6 @@
     {
         if (GuiTextBox(textBoxBounds, text, textMaxSize, textEditMode)) textEditMode = !textEditMode;
     }
-    GuiSetStyle(TEXTBOX, TEXT_ALIGNMENT, prevTextBoxAlignment);
 
     int prevBtnTextAlignment = GuiGetStyle(BUTTON, TEXT_ALIGNMENT);
     GuiSetStyle(BUTTON, TEXT_ALIGNMENT, TEXT_ALIGN_CENTER);
@@ -4367,7 +4231,7 @@
 // Grid control
 // NOTE: Returns grid mouse-hover selected cell
 // About drawing lines at subpixel spacing, simple put, not easy solution:
-// Ref: https://stackoverflow.com/questions/4435450/2d-opengl-drawing-lines-that-dont-exactly-fit-pixel-raster
+// REF: https://stackoverflow.com/questions/4435450/2d-opengl-drawing-lines-that-dont-exactly-fit-pixel-raster
 int GuiGrid(Rectangle bounds, const char *text, float spacing, int subdivs, Vector2 *mouseCell)
 {
     // Grid lines alpha amount
@@ -6120,4 +5984,482 @@
 }
 #endif      // RAYGUI_STANDALONE
 
-#endif      // RAYGUI_IMPLEMENTATION
+
+// --- Custom --- //
+int JUNE_GuiButton(Rectangle bounds, const char *text, int borderWidth, Color borderColor)
+{
+    int result = 0;
+    GuiState state = guiState;
+
+    // Update control
+    //--------------------------------------------------------------------
+    if ((state != STATE_DISABLED) && !guiLocked && !guiControlExclusiveMode)
+    {
+        Vector2 mousePoint = GetMousePosition();
+
+        // Check button state
+        if (CheckCollisionPointRec(mousePoint, bounds))
+        {
+            if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) state = STATE_PRESSED;
+            else state = STATE_FOCUSED;
+
+            if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) result = 1;
+        }
+    }
+    //--------------------------------------------------------------------
+
+    // Draw control
+    //--------------------------------------------------------------------
+    GuiDrawRectangle(bounds, borderWidth, borderColor, GetColor(GuiGetStyle(BUTTON, BASE + (state*3))));
+    GuiDrawText(text, GetTextBounds(BUTTON, bounds), GuiGetStyle(BUTTON, TEXT_ALIGNMENT), GetColor(GuiGetStyle(BUTTON, TEXT + (state*3))));
+
+    if (state == STATE_FOCUSED) GuiTooltip(bounds);
+    //------------------------------------------------------------------
+
+    return result;      // Button pressed: result = 1
+}
+
+int JUNE_GuiTextBox(Rectangle bounds, char *text, int textSize, bool editMode)
+{
+    #if !defined(RAYGUI_TEXTBOX_AUTO_CURSOR_COOLDOWN)
+        #define RAYGUI_TEXTBOX_AUTO_CURSOR_COOLDOWN  20        // Frames to wait for autocursor movement
+    #endif
+    #if !defined(RAYGUI_TEXTBOX_AUTO_CURSOR_DELAY)
+        #define RAYGUI_TEXTBOX_AUTO_CURSOR_DELAY      1        // Frames delay for autocursor movement
+    #endif
+
+    int result = 0;
+    GuiState state = guiState;
+
+    bool multiline = true;
+    int wrapMode = GuiGetStyle(DEFAULT, TEXT_WRAP_MODE);
+
+    Rectangle textBounds = GetTextBounds(TEXTBOX, bounds);
+    int textLength = (text != NULL)? (int)strlen(text) : 0; // Get current text length
+    int thisCursorIndex = textBoxCursorIndex;
+    if (thisCursorIndex > textLength) thisCursorIndex = textLength;
+    int textWidth = GuiGetTextWidth(text) - GuiGetTextWidth(text + thisCursorIndex);
+    int textIndexOffset = 0; // Text index offset to start drawing in the box
+
+    // Cursor rectangle
+    // NOTE: Position X value should be updated
+    Rectangle cursor = {
+        textBounds.x + textWidth + GuiGetStyle(DEFAULT, TEXT_SPACING),
+        textBounds.y + GuiGetStyle(DEFAULT, TEXT_SIZE),
+        2,
+        (float)GuiGetStyle(DEFAULT, TEXT_SIZE)
+    };
+
+    if (cursor.height >= bounds.height) cursor.height = bounds.height - GuiGetStyle(TEXTBOX, BORDER_WIDTH)*2;
+    if (cursor.y < (bounds.y + GuiGetStyle(TEXTBOX, BORDER_WIDTH))) cursor.y = bounds.y + GuiGetStyle(TEXTBOX, BORDER_WIDTH);
+
+    // Mouse cursor rectangle
+    // NOTE: Initialized outside of screen
+    Rectangle mouseCursor = cursor;
+    mouseCursor.x = -1;
+    mouseCursor.width = 1;
+
+    // Blink-cursor frame counter
+    //if (!autoCursorMode) blinkCursorFrameCounter++;
+    //else blinkCursorFrameCounter = 0;
+
+    // Update control
+    //--------------------------------------------------------------------
+    // WARNING: Text editing is only supported under certain conditions:
+    if ((state != STATE_DISABLED) &&                // Control not disabled
+        !GuiGetStyle(TEXTBOX, TEXT_READONLY) &&     // TextBox not on read-only mode
+        !guiLocked &&                               // Gui not locked
+        !guiControlExclusiveMode &&                       // No gui slider on dragging
+        (wrapMode == TEXT_WRAP_NONE))               // No wrap mode
+    {
+        Vector2 mousePosition = GetMousePosition();
+
+        if (editMode)
+        {
+            // GLOBAL: Auto-cursor movement logic
+            // NOTE: Keystrokes are handled repeatedly when button is held down for some time
+            if (IsKeyDown(KEY_LEFT) || IsKeyDown(KEY_RIGHT) || IsKeyDown(KEY_UP) || IsKeyDown(KEY_DOWN) || IsKeyDown(KEY_BACKSPACE) || IsKeyDown(KEY_DELETE)) autoCursorCounter++;
+            else autoCursorCounter = 0;
+
+            bool autoCursorShouldTrigger = (autoCursorCounter > RAYGUI_TEXTBOX_AUTO_CURSOR_COOLDOWN) && ((autoCursorCounter % RAYGUI_TEXTBOX_AUTO_CURSOR_DELAY) == 0);
+
+            state = STATE_PRESSED;
+
+            if (textBoxCursorIndex > textLength) textBoxCursorIndex = textLength;
+
+            // If text does not fit in the textbox and current cursor position is out of bounds,
+            // we add an index offset to text for drawing only what requires depending on cursor
+            while (textWidth >= textBounds.width)
+            {
+                int nextCodepointSize = 0;
+                GetCodepointNext(text + textIndexOffset, &nextCodepointSize);
+
+                textIndexOffset += nextCodepointSize;
+
+                textWidth = GuiGetTextWidth(text + textIndexOffset) - GuiGetTextWidth(text + textBoxCursorIndex);
+            }
+
+            int codepoint = GetCharPressed();       // Get Unicode codepoint
+            if (multiline && IsKeyPressed(KEY_ENTER)) codepoint = (int)'\n';
+
+            // Encode codepoint as UTF-8
+            int codepointSize = 0;
+            const char *charEncoded = CodepointToUTF8(codepoint, &codepointSize);
+
+            // Handle text paste action
+            if (IsKeyPressed(KEY_V) && (IsKeyDown(KEY_LEFT_CONTROL) || IsKeyDown(KEY_RIGHT_CONTROL)))
+            {
+                const char *pasteText = GetClipboardText();
+                if (pasteText != NULL)
+                {
+                    int pasteLength = 0;
+                    int pasteCodepoint;
+                    int pasteCodepointSize;
+
+                    // Count how many codepoints to copy, stopping at the first unwanted control character
+                    while (true)
+                    {
+                        pasteCodepoint = GetCodepointNext(pasteText + pasteLength, &pasteCodepointSize);
+                        if (textLength + pasteLength + pasteCodepointSize >= textSize) break;
+                        if (!(multiline && (pasteCodepoint == (int)'\n')) && !(pasteCodepoint >= 32)) break;
+                        pasteLength += pasteCodepointSize;
+                    }
+
+                    if (pasteLength > 0)
+                    {
+                        // Move forward data from cursor position
+                        for (int i = textLength + pasteLength; i > textBoxCursorIndex; i--) text[i] = text[i - pasteLength];
+
+                        // Paste data in at cursor
+                        for (int i = 0; i < pasteLength; i++) text[textBoxCursorIndex + i] = pasteText[i];
+
+                        textBoxCursorIndex += pasteLength;
+                        textLength += pasteLength;
+                        text[textLength] = '\0';
+                    }
+                }
+            }
+            else if (((multiline && (codepoint == (int)'\n')) || (codepoint >= 32)) && ((textLength + codepointSize) < textSize))
+            {
+                // Adding codepoint to text, at current cursor position
+
+                // Move forward data from cursor position
+                for (int i = (textLength + codepointSize); i > textBoxCursorIndex; i--) text[i] = text[i - codepointSize];
+
+                // Add new codepoint in current cursor position
+                for (int i = 0; i < codepointSize; i++) text[textBoxCursorIndex + i] = charEncoded[i];
+
+                textBoxCursorIndex += codepointSize;
+                textLength += codepointSize;
+
+                // Make sure text last character is EOL
+                text[textLength] = '\0';
+            }
+
+            // Move cursor to start
+            if ((textLength > 0) && IsKeyPressed(KEY_HOME)) textBoxCursorIndex = 0;
+
+            // Move cursor to end
+            if ((textLength > textBoxCursorIndex) && IsKeyPressed(KEY_END)) textBoxCursorIndex = textLength;
+
+            // Delete related codepoints from text, after current cursor position
+            if ((textLength > textBoxCursorIndex) && IsKeyPressed(KEY_DELETE) && (IsKeyDown(KEY_LEFT_CONTROL) || IsKeyDown(KEY_RIGHT_CONTROL)))
+            {
+                int offset = textBoxCursorIndex;
+                int accCodepointSize = 0;
+                int nextCodepointSize;
+                int nextCodepoint;
+
+                // Check characters of the same type to delete (either ASCII punctuation or anything non-whitespace)
+                // Not using isalnum() since it only works on ASCII characters
+                nextCodepoint = GetCodepointNext(text + offset, &nextCodepointSize);
+                bool puctuation = ispunct(nextCodepoint & 0xff);
+                while (offset < textLength)
+                {
+                    if ((puctuation && !ispunct(nextCodepoint & 0xff)) || (!puctuation && (isspace(nextCodepoint & 0xff) || ispunct(nextCodepoint & 0xff))))
+                        break;
+                    offset += nextCodepointSize;
+                    accCodepointSize += nextCodepointSize;
+                    nextCodepoint = GetCodepointNext(text + offset, &nextCodepointSize);
+                }
+
+                // Check whitespace to delete (ASCII only)
+                while (offset < textLength)
+                {
+                    if (!isspace(nextCodepoint & 0xff)) break;
+
+                    offset += nextCodepointSize;
+                    accCodepointSize += nextCodepointSize;
+                    nextCodepoint = GetCodepointNext(text + offset, &nextCodepointSize);
+                }
+
+                // Move text after cursor forward (including final null terminator)
+                for (int i = offset; i <= textLength; i++) text[i - accCodepointSize] = text[i];
+
+                textLength -= accCodepointSize;
+            }
+
+            else if ((textLength > textBoxCursorIndex) && (IsKeyPressed(KEY_DELETE) || (IsKeyDown(KEY_DELETE) && autoCursorShouldTrigger)))
+            {
+                // Delete single codepoint from text, after current cursor position
+
+                int nextCodepointSize = 0;
+                GetCodepointNext(text + textBoxCursorIndex, &nextCodepointSize);
+
+                // Move text after cursor forward (including final null terminator)
+                for (int i = textBoxCursorIndex + nextCodepointSize; i <= textLength; i++) text[i - nextCodepointSize] = text[i];
+
+                textLength -= nextCodepointSize;
+            }
+
+            // Delete related codepoints from text, before current cursor position
+            if ((textBoxCursorIndex > 0) && IsKeyPressed(KEY_BACKSPACE) && (IsKeyDown(KEY_LEFT_CONTROL) || IsKeyDown(KEY_RIGHT_CONTROL)))
+            {
+                int offset = textBoxCursorIndex;
+                int accCodepointSize = 0;
+                int prevCodepointSize = 0;
+                int prevCodepoint = 0;
+
+                // Check whitespace to delete (ASCII only)
+                while (offset > 0)
+                {
+                    prevCodepoint = GetCodepointPrevious(text + offset, &prevCodepointSize);
+                    if (!isspace(prevCodepoint & 0xff)) break;
+
+                    offset -= prevCodepointSize;
+                    accCodepointSize += prevCodepointSize;
+                }
+
+                // Check characters of the same type to delete (either ASCII punctuation or anything non-whitespace)
+                // Not using isalnum() since it only works on ASCII characters
+                bool puctuation = ispunct(prevCodepoint & 0xff);
+                while (offset > 0)
+                {
+                    prevCodepoint = GetCodepointPrevious(text + offset, &prevCodepointSize);
+                    if ((puctuation && !ispunct(prevCodepoint & 0xff)) || (!puctuation && (isspace(prevCodepoint & 0xff) || ispunct(prevCodepoint & 0xff)))) break;
+
+                    offset -= prevCodepointSize;
+                    accCodepointSize += prevCodepointSize;
+                }
+
+                // Move text after cursor forward (including final null terminator)
+                for (int i = textBoxCursorIndex; i <= textLength; i++) text[i - accCodepointSize] = text[i];
+
+                textLength -= accCodepointSize;
+                textBoxCursorIndex -= accCodepointSize;
+            }
+
+            else if ((textBoxCursorIndex > 0) && (IsKeyPressed(KEY_BACKSPACE) || (IsKeyDown(KEY_BACKSPACE) && autoCursorShouldTrigger)))
+            {
+                // Delete single codepoint from text, before current cursor position
+
+                int prevCodepointSize = 0;
+
+                GetCodepointPrevious(text + textBoxCursorIndex, &prevCodepointSize);
+
+                // Move text after cursor forward (including final null terminator)
+                for (int i = textBoxCursorIndex; i <= textLength; i++) text[i - prevCodepointSize] = text[i];
+
+                textLength -= prevCodepointSize;
+                textBoxCursorIndex -= prevCodepointSize;
+            }
+
+            // Move cursor position with keys
+            if ((textBoxCursorIndex > 0) && IsKeyPressed(KEY_LEFT) && (IsKeyDown(KEY_LEFT_CONTROL) || IsKeyDown(KEY_RIGHT_CONTROL)))
+            {
+                int offset = textBoxCursorIndex;
+                //int accCodepointSize = 0;
+                int prevCodepointSize = 0;
+                int prevCodepoint = 0;
+
+                // Check whitespace to skip (ASCII only)
+                while (offset > 0)
+                {
+                    prevCodepoint = GetCodepointPrevious(text + offset, &prevCodepointSize);
+                    if (!isspace(prevCodepoint & 0xff)) break;
+
+                    offset -= prevCodepointSize;
+                    //accCodepointSize += prevCodepointSize;
+                }
+
+                // Check characters of the same type to skip (either ASCII punctuation or anything non-whitespace)
+                // Not using isalnum() since it only works on ASCII characters
+                bool puctuation = ispunct(prevCodepoint & 0xff);
+                while (offset > 0)
+                {
+                    prevCodepoint = GetCodepointPrevious(text + offset, &prevCodepointSize);
+                    if ((puctuation && !ispunct(prevCodepoint & 0xff)) || (!puctuation && (isspace(prevCodepoint & 0xff) || ispunct(prevCodepoint & 0xff)))) break;
+
+                    offset -= prevCodepointSize;
+                    //accCodepointSize += prevCodepointSize;
+                }
+
+                textBoxCursorIndex = offset;
+            }
+            else if ((textBoxCursorIndex > 0) && (IsKeyPressed(KEY_LEFT) || (IsKeyDown(KEY_LEFT) && autoCursorShouldTrigger)))
+            {
+                int prevCodepointSize = 0;
+                GetCodepointPrevious(text + textBoxCursorIndex, &prevCodepointSize);
+
+                textBoxCursorIndex -= prevCodepointSize;
+            }
+            else if ((textLength > textBoxCursorIndex) && IsKeyPressed(KEY_RIGHT) && (IsKeyDown(KEY_LEFT_CONTROL) || IsKeyDown(KEY_RIGHT_CONTROL)))
+            {
+                int offset = textBoxCursorIndex;
+                //int accCodepointSize = 0;
+                int nextCodepointSize;
+                int nextCodepoint;
+
+                // Check characters of the same type to skip (either ASCII punctuation or anything non-whitespace)
+                // Not using isalnum() since it only works on ASCII characters
+                nextCodepoint = GetCodepointNext(text + offset, &nextCodepointSize);
+                bool puctuation = ispunct(nextCodepoint & 0xff);
+                while (offset < textLength)
+                {
+                    if ((puctuation && !ispunct(nextCodepoint & 0xff)) || (!puctuation && (isspace(nextCodepoint & 0xff) || ispunct(nextCodepoint & 0xff)))) break;
+
+                    offset += nextCodepointSize;
+                    //accCodepointSize += nextCodepointSize;
+                    nextCodepoint = GetCodepointNext(text + offset, &nextCodepointSize);
+                }
+
+                // Check whitespace to skip (ASCII only)
+                while (offset < textLength)
+                {
+                    if (!isspace(nextCodepoint & 0xff)) break;
+
+                    offset += nextCodepointSize;
+                    //accCodepointSize += nextCodepointSize;
+                    nextCodepoint = GetCodepointNext(text + offset, &nextCodepointSize);
+                }
+
+                textBoxCursorIndex = offset;
+            }
+            else if ((textLength > textBoxCursorIndex) && (IsKeyPressed(KEY_RIGHT) || (IsKeyDown(KEY_RIGHT) && autoCursorShouldTrigger)))
+            {
+                int nextCodepointSize = 0;
+                GetCodepointNext(text + textBoxCursorIndex, &nextCodepointSize);
+
+                textBoxCursorIndex += nextCodepointSize;
+            }
+
+            // Move cursor position with mouse
+            if (CheckCollisionPointRec(mousePosition, textBounds))     // Mouse hover text
+            {
+                float scaleFactor = (float)GuiGetStyle(DEFAULT, TEXT_SIZE)/(float)guiFont.baseSize;
+                int codepointIndex = 0;
+                float glyphWidth = 0.0f;
+                float widthToMouseX = 0;
+                int mouseCursorIndex = 0;
+
+                for (int i = textIndexOffset; i < textLength; i += codepointSize)
+                {
+                    codepoint = GetCodepointNext(&text[i], &codepointSize);
+                    codepointIndex = GetGlyphIndex(guiFont, codepoint);
+
+                    if (guiFont.glyphs[codepointIndex].advanceX == 0) glyphWidth = ((float)guiFont.recs[codepointIndex].width*scaleFactor);
+                    else glyphWidth = ((float)guiFont.glyphs[codepointIndex].advanceX*scaleFactor);
+
+                    if (mousePosition.x <= (textBounds.x + (widthToMouseX + glyphWidth/2)))
+                    {
+                        mouseCursor.x = textBounds.x + widthToMouseX;
+                        mouseCursorIndex = i;
+                        break;
+                    }
+
+                    widthToMouseX += (glyphWidth + (float)GuiGetStyle(DEFAULT, TEXT_SPACING));
+                }
+
+                // Check if mouse cursor is at the last position
+                int textEndWidth = GuiGetTextWidth(text + textIndexOffset);
+                if (GetMousePosition().x >= (textBounds.x + textEndWidth - glyphWidth/2))
+                {
+                    mouseCursor.x = textBounds.x + textEndWidth;
+                    mouseCursorIndex = textLength;
+                }
+
+                // Place cursor at required index on mouse click
+                if ((mouseCursor.x >= 0) && IsMouseButtonPressed(MOUSE_LEFT_BUTTON))
+                {
+                    cursor.x = mouseCursor.x;
+                    textBoxCursorIndex = mouseCursorIndex;
+                }
+            }
+            else mouseCursor.x = -1;
+
+            // Recalculate cursor position.y depending on textBoxCursorIndex
+            cursor.x = bounds.x + GuiGetStyle(TEXTBOX, TEXT_PADDING) + GuiGetTextWidth(text + textIndexOffset) - GuiGetTextWidth(text + textBoxCursorIndex) + GuiGetStyle(DEFAULT, TEXT_SPACING);
+            if (multiline) {
+              const char **lines = GetTextLines(text, &cursor.y);
+              printf("Cursor: %f", cursor.y);
+            }
+
+            // Finish text editing on ENTER or mouse click outside bounds
+            if ((!multiline && IsKeyPressed(KEY_ENTER)) ||
+                (!CheckCollisionPointRec(mousePosition, bounds) && IsMouseButtonPressed(MOUSE_LEFT_BUTTON)))
+            {
+                textBoxCursorIndex = 0;     // GLOBAL: Reset the shared cursor index
+                autoCursorCounter = 0;      // GLOBAL: Reset counter for repeated keystrokes
+                result = 1;
+            }
+        }
+        else
+        {
+            if (CheckCollisionPointRec(mousePosition, bounds))
+            {
+                state = STATE_FOCUSED;
+
+                if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON))
+                {
+                    textBoxCursorIndex = textLength;   // GLOBAL: Place cursor index to the end of current text
+                    autoCursorCounter = 0;             // GLOBAL: Reset counter for repeated keystrokes
+                    result = 1;
+                }
+            }
+        }
+    }
+    //--------------------------------------------------------------------
+
+    // Draw control
+    //--------------------------------------------------------------------
+    if (state == STATE_PRESSED)
+    {
+        GuiDrawRectangle(bounds, GuiGetStyle(TEXTBOX, BORDER_WIDTH), GetColor(GuiGetStyle(TEXTBOX, BORDER + (state*3))), GetColor(GuiGetStyle(TEXTBOX, BASE_COLOR_PRESSED)));
+    }
+    else if (state == STATE_DISABLED)
+    {
+        GuiDrawRectangle(bounds, GuiGetStyle(TEXTBOX, BORDER_WIDTH), GetColor(GuiGetStyle(TEXTBOX, BORDER + (state*3))), GetColor(GuiGetStyle(TEXTBOX, BASE_COLOR_DISABLED)));
+    }
+    else GuiDrawRectangle(bounds, GuiGetStyle(TEXTBOX, BORDER_WIDTH), GetColor(GuiGetStyle(TEXTBOX, BORDER + (state*3))), BLANK);
+
+
+
+    int prevVerticalAlignment = GuiGetStyle(DEFAULT, TEXT_ALIGNMENT_VERTICAL);
+    if (multiline) GuiSetStyle(DEFAULT, TEXT_ALIGNMENT_VERTICAL, TEXT_ALIGN_TOP);
+
+    // Draw text considering index offset if required
+    // NOTE: Text index offset depends on cursor position
+    GuiDrawText(
+        text + textIndexOffset,
+        textBounds, GuiGetStyle(TEXTBOX, TEXT_ALIGNMENT), GetColor(GuiGetStyle(TEXTBOX, TEXT + (state*3))));
+
+    // RESET 
+    if (multiline) GuiSetStyle(DEFAULT, TEXT_ALIGNMENT_VERTICAL, prevVerticalAlignment);
+
+    // Draw cursor
+    if (editMode && !GuiGetStyle(TEXTBOX, TEXT_READONLY))
+    {
+        //if (autoCursorMode || ((blinkCursorFrameCounter/40)%2 == 0))
+        GuiDrawRectangle(cursor, 0, BLANK, GetColor(GuiGetStyle(TEXTBOX, BORDER_COLOR_PRESSED)));
+
+        // Draw mouse position cursor (if required)
+        if (mouseCursor.x >= 0) GuiDrawRectangle(mouseCursor, 0, BLANK, GetColor(GuiGetStyle(TEXTBOX, BORDER_COLOR_PRESSED)));
+    }
+    else if (state == STATE_FOCUSED) GuiTooltip(bounds);
+    //--------------------------------------------------------------------
+
+    return result;      // Mouse button pressed: result = 1
+}
+
+
+#endif      // RAYGUI_IMPLEMENTnk_command_bufferATION