From dee98894237b4e8dbeb6133d7f929fe0e625d2ed Mon Sep 17 00:00:00 2001 From: Evgeny Date: Wed, 1 Jul 2026 12:24:48 +0300 Subject: [PATCH] action popup: convert \n -> \r\n for Windows EDIT control line breaks --- tools/etcpmon/etcpmon_gui.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/tools/etcpmon/etcpmon_gui.c b/tools/etcpmon/etcpmon_gui.c index af3f6cbf..5e717604 100644 --- a/tools/etcpmon/etcpmon_gui.c +++ b/tools/etcpmon/etcpmon_gui.c @@ -1366,8 +1366,19 @@ static void on_action_result(const char* text, void* user_data) { } if (IsWindow(app->hActionResultEdit)) { - SendMessageA(app->hActionResultEdit, EM_SETSEL, -1, -1); - SendMessageA(app->hActionResultEdit, EM_REPLACESEL, FALSE, (LPARAM)text); + size_t tlen = strlen(text); + char* crlf = (char*)malloc(tlen * 2 + 1); + if (crlf) { + size_t out = 0; + for (size_t i = 0; i < tlen; i++) { + if (text[i] == '\n') crlf[out++] = '\r'; + crlf[out++] = text[i]; + } + crlf[out] = '\0'; + SendMessageA(app->hActionResultEdit, EM_SETSEL, -1, -1); + SendMessageA(app->hActionResultEdit, EM_REPLACESEL, FALSE, (LPARAM)crlf); + free(crlf); + } int lines = (int)SendMessage(app->hActionResultEdit, EM_GETLINECOUNT, 0, 0); SendMessage(app->hActionResultEdit, EM_LINESCROLL, 0, lines);