action popup: convert \n -> \r\n for Windows EDIT control line breaks
This commit is contained in:
1 parent
35871891db
commit
dee9889423
1 file changed
+13
-2
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user