From 6a2f57f82ee0de8e0b368e191efae63409a32db8 Mon Sep 17 00:00:00 2001 From: BenTalagan Date: Sat, 22 Nov 2025 17:14:13 +0100 Subject: [PATCH] Update ReaImGui Markdown v0.1.9 > v0.1.10 --- Development/talagan_ReaImGui Markdown.lua | 5 ++--- .../reaimgui_markdown/markdown-imgui.lua | 9 +++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Development/talagan_ReaImGui Markdown.lua b/Development/talagan_ReaImGui Markdown.lua index 0b9db274b..7bccf58b4 100644 --- a/Development/talagan_ReaImGui Markdown.lua +++ b/Development/talagan_ReaImGui Markdown.lua @@ -1,14 +1,13 @@ --[[ @description ReaImGui Markdown : A Markdown rendering library for ReaImGui -@version 0.1.9 +@version 0.1.10 @author Ben 'Talagan' Babut @license MIT @donation https://www.paypal.com/donate/?business=3YEZMY9D6U8NC&no_recurring=1¤cy_code=EUR @links Forum Thread https://forum.cockos.com/showthread.php?t=301055 @changelog - - [Cosmetics] Realigned checkboxes vertically - - [Hotfix] ImGui context switching not handled properly + - [Optimization] Reduce split function cost (thanks @Arkadata!) @metapackage @provides [nomain] talagan_ReaImGui Markdown/reaimgui_markdown/**/*.lua diff --git a/Development/talagan_ReaImGui Markdown/reaimgui_markdown/markdown-imgui.lua b/Development/talagan_ReaImGui Markdown/reaimgui_markdown/markdown-imgui.lua index b731678a6..5d7b8df89 100644 --- a/Development/talagan_ReaImGui Markdown/reaimgui_markdown/markdown-imgui.lua +++ b/Development/talagan_ReaImGui Markdown/reaimgui_markdown/markdown-imgui.lua @@ -101,11 +101,11 @@ local function split_into_words_and_spaces(str) table.insert(result, char) i = i + 1 else - local word = "" + local word_chars = {} -- Table au lieu de string pour éviter O(n²) -- Aggregate characters (letters or anything) while i <= len and not is_white_space(char) do - word = word .. char + table.insert(word_chars, char) i = i + 1 char = str:sub(i, i) end @@ -118,11 +118,12 @@ local function split_into_words_and_spaces(str) local next_char = str:sub(next_i, next_i) if next_i <= len and punctuations[next_char] then - word = word .. " " .. next_char + table.insert(word_chars, " ") + table.insert(word_chars, next_char) i = next_i + 1 end end - table.insert(result, word) + table.insert(result, table.concat(word_chars)) end end