From 7806b24388291a15b5cda04531c23ed417339ab7 Mon Sep 17 00:00:00 2001 From: zeromus Date: Sun, 21 Aug 2022 15:35:45 -0400 Subject: [PATCH] winport - fix prefix checking on memwatch addresses (fixes #496) --- src/drivers/win/window.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/drivers/win/window.cpp b/src/drivers/win/window.cpp index b3f7d64b..3effd90d 100644 --- a/src/drivers/win/window.cpp +++ b/src/drivers/win/window.cpp @@ -3523,9 +3523,10 @@ LRESULT APIENTRY FilterEditCtrlProc(HWND hwnd, UINT msg, WPARAM wP, LPARAM lP) case WM_CHAR: { - int len = GetWindowTextLength(hwnd); + DWORD cpBegin, cpEnd; + SendMessage(hwnd, EM_GETSEL, (LPARAM)&cpBegin, (LPARAM)&cpEnd); IsLetterLegalProc isLetterLegal = GetIsLetterLegalProc(GetDlgCtrlID(hwnd)); - through = IsInputLegal(isLetterLegal, len, wP); + through = IsInputLegal(isLetterLegal, (int)cpBegin, wP); if (!through) ShowLetterIllegalBalloonTip(hwnd, isLetterLegal); }