Skip to content

Commit

Permalink
不要なwhileを外す
Browse files Browse the repository at this point in the history
  • Loading branch information
ndekopon committed Jul 4, 2024
1 parent d495e5f commit 2a7769c
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions src/main_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -516,24 +516,19 @@ namespace app
if (text)
{
HWND edit = edit_log_.at(id);
while (true)

auto linecount = ::SendMessageW(edit, EM_GETLINECOUNT, 0, 0);
if (linecount >= MAX_LOGLINE)
{
auto linecount = ::SendMessageW(edit, EM_GETLINECOUNT, 0, 0);
if (linecount >= MAX_LOGLINE)
{
auto len = ::SendMessageW(edit, WM_GETTEXTLENGTH, 0, 0);
::SendMessageW(edit, EM_SETSEL, (WPARAM)0, (LPARAM)len);
WCHAR tmp[] = L"";
::SendMessageW(edit, EM_REPLACESEL, FALSE, (LPARAM)tmp);
}
else
{
auto len = ::SendMessageW(edit, WM_GETTEXTLENGTH, 0, 0);
::SendMessageW(edit, EM_SETSEL, (WPARAM)len, (LPARAM)len);
::SendMessageW(edit, EM_REPLACESEL, FALSE, (LPARAM)text->c_str());
break;
}
auto len = ::SendMessageW(edit, WM_GETTEXTLENGTH, 0, 0);
::SendMessageW(edit, EM_SETSEL, (WPARAM)0, (LPARAM)len);
WCHAR tmp[] = L"";
::SendMessageW(edit, EM_REPLACESEL, FALSE, (LPARAM)tmp);
}

auto len = ::SendMessageW(edit, WM_GETTEXTLENGTH, 0, 0);
::SendMessageW(edit, EM_SETSEL, (WPARAM)len, (LPARAM)len);
::SendMessageW(edit, EM_REPLACESEL, FALSE, (LPARAM)text->c_str());
}
}
break;
Expand Down

0 comments on commit 2a7769c

Please sign in to comment.