From 40adc3820140c5a52d134a7f7085e328776bec99 Mon Sep 17 00:00:00 2001 From: Alan Kilborn Date: Tue, 20 Feb 2024 08:42:47 -0500 Subject: [PATCH] Prevent typing control characters into document Fix #13279, close #14766 --- .../src/ScintillaComponent/ScintillaEditView.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp index 33432a3b5..ebd16d0b0 100644 --- a/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp @@ -497,6 +497,17 @@ LRESULT ScintillaEditView::scintillaNew_Proc(HWND hwnd, UINT Message, WPARAM wPa break; } + case WM_CHAR: + { + // prevent "control characters" from being entered in text + // (don't need to be concerned about Tab or CR or LF etc here) + if ((wParam >= 0 && wParam <= 31) || wParam == 127) + { + return FALSE; + } + break; + } + case WM_KEYUP: { if (wParam == VK_PRIOR || wParam == VK_NEXT)