From 414e7d36a01c64611f481d129bb2f9f893e7a5b3 Mon Sep 17 00:00:00 2001 From: paxcut <53811119+paxcut@users.noreply.github.com> Date: Sun, 15 Sep 2024 06:27:24 -0700 Subject: [PATCH] fix: Double-clicking a string selects the closing double quotes (#1862) This is a simple fix for a simple issue. Just check if the last char in the selection is a double quote and if it is, make the selection one char shorter. --------- Co-authored-by: Nik --- .../imgui/ColorTextEditor/source/TextEditor.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/third_party/imgui/ColorTextEditor/source/TextEditor.cpp b/lib/third_party/imgui/ColorTextEditor/source/TextEditor.cpp index 8c540a4e4..becd24943 100644 --- a/lib/third_party/imgui/ColorTextEditor/source/TextEditor.cpp +++ b/lib/third_party/imgui/ColorTextEditor/source/TextEditor.cpp @@ -392,8 +392,13 @@ TextEditor::Coordinates TextEditor::FindWordEnd(const Coordinates &aFrom) const while (cindex < (line.size()) && !isWordChar(line[cindex].mChar)) ++cindex; - while (cindex < (line.size()) && isWordChar(line[cindex].mChar)) - ++cindex; + if (prevspace != !!isspace(c)) { + if (isspace(c)) + while (cindex < (int)line.size() && isspace(line[cindex].mChar)) + ++cindex; + break; + } + cindex += d; if (line[cindex-1].mChar == '\"') --cindex;