From a2dd3d187967cd838747329dc37382796b01ad4f Mon Sep 17 00:00:00 2001 From: johnsonj Date: Mon, 14 Dec 2015 15:03:51 +1100 Subject: Block IME when some selected text is protected. --- doc/ScintillaHistory.html | 4 ++++ gtk/ScintillaGTK.cxx | 2 +- qt/ScintillaEditBase/ScintillaEditBase.cpp | 2 +- win32/ScintillaWin.cxx | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index 57680f59a..29e664b12 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -541,6 +541,10 @@ On GTK+ and Qt, Korean input by word fixed.
  • + On GTK+, Qt, and Win32 block IME input when document is read-only or any selected text + is protected. +
  • +
  • On GTK+ on OS X, fix warning during destruction. Bug #1777.
  • diff --git a/gtk/ScintillaGTK.cxx b/gtk/ScintillaGTK.cxx index 19576ce9e..eaf2e26f8 100644 --- a/gtk/ScintillaGTK.cxx +++ b/gtk/ScintillaGTK.cxx @@ -2434,7 +2434,7 @@ void ScintillaGTK::PreeditChangedInlineThis() { // Copy & paste by johnsonj with a lot of helps of Neil // Great thanks for my foreruners, jiniya and BLUEnLIVE try { - if (pdoc->IsReadOnly()) { + if (pdoc->IsReadOnly() || SelectionContainsProtected()) { gtk_im_context_reset(im_context); return; } diff --git a/qt/ScintillaEditBase/ScintillaEditBase.cpp b/qt/ScintillaEditBase/ScintillaEditBase.cpp index ea516fe17..13401fedf 100644 --- a/qt/ScintillaEditBase/ScintillaEditBase.cpp +++ b/qt/ScintillaEditBase/ScintillaEditBase.cpp @@ -443,7 +443,7 @@ void ScintillaEditBase::inputMethodEvent(QInputMethodEvent *event) // Copy & paste by johnsonj with a lot of helps of Neil // Great thanks for my forerunners, jiniya and BLUEnLIVE - if (sqt->pdoc->IsReadOnly()) { + if (sqt->pdoc->IsReadOnly() || sqt->SelectionContainsProtected()) { // Here, a canceling and/or completing composition function is needed. return; } diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx index b97a39ff3..f536482a1 100644 --- a/win32/ScintillaWin.cxx +++ b/win32/ScintillaWin.cxx @@ -1007,7 +1007,7 @@ sptr_t ScintillaWin::HandleCompositionInline(uptr_t, sptr_t lParam) { IMContext imc(MainHWND()); if (!imc.hIMC) return 0; - if (pdoc->IsReadOnly()) { + if (pdoc->IsReadOnly() || SelectionContainsProtected()) { ::ImmNotifyIME(imc.hIMC, NI_COMPOSITIONSTR, CPS_CANCEL, 0); return 0; } -- cgit v1.2.3