MCPcopy Create free account
hub / github.com/DiscordMessenger/dm / OnUpdateText

Method OnUpdateText

src/windows/MessageEditor.cpp:512–544  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

510}
511
512void MessageEditor::OnUpdateText()
513{
514 EditWndProc(m_edit_hwnd, WM_UPDATETEXTSIZE, 0, 0);
515
516 if (!IsWindowEnabled(m_edit_hwnd))
517 return;
518
519 /*
520 // This is a VERY loose approximate. For every \n character there will also be a
521 // \r character in the input buffer. If you need this to be exact, make it go through
522 // the entire text every character, or count the characters. Use for speed.
523 int length = Edit_GetTextLength(m_edit_hwnd);
524 SendMessage(g_Hwnd, WM_UPDATEMESSAGELENGTH, 0, (LPARAM)length);
525 return;
526 */
527
528 // How slow could this possibly be.
529 int length = Edit_GetTextLength(m_edit_hwnd);
530
531 TCHAR* tchr = new TCHAR[length + 1];
532 Edit_GetText(m_edit_hwnd, tchr, length + 1);
533
534 int actualLength = length;
535 for (int i = 0; i < length; i++) {
536 if (tchr[i] == (TCHAR)'\r')
537 actualLength--;
538 }
539
540 SendMessage(g_Hwnd, WM_UPDATEMESSAGELENGTH, 0, (LPARAM)actualLength);
541
542 m_autoComplete.Update(tchr, length);
543 delete[] tchr;
544}
545
546void MessageEditor::OnLoadedMemberChunk()
547{

Callers 1

EditWndProcMethod · 0.80

Calls 1

UpdateMethod · 0.45

Tested by

no test coverage detected