<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Auto-Completion Popup is unexpectedly shown when handling SCN_CHARADDED]]></title><description><![CDATA[<p dir="auto">I have the following Notepad++ settings under the Preferences -&gt; Auto-Completion:</p>
<ul>
<li>[v] Enable auto-completion on each input</li>
<li>(*) Function and word completion</li>
<li>[v] Function parameters hint on input</li>
<li>From 2nd character</li>
</ul>
<p dir="auto">This is to have the pretty nice Auto-Completion Popup while I’m typing.</p>
<p dir="auto">Now, I have the source code that basically does the following:</p>
<pre><code>extern "C" __declspec(dllexport) void beNotified(SCNotification* pscn)
{
  switch ( pscn-&gt;nmhdr.code )
  {
    case SCN_CHARADDED:
      if (pscn-&gt;ch == '\"')
      {
        HWND hSci = (HWND) pscn-&gt;nmhdr.hwndFrom;
        Sci_Position pos = (Sci_Position) SendMessage(hSci, SCI_GETSELECTIONSTART, 0, 0); // position right after the just typed '"'
        SendMessage(hSci, SCI_SETSEL, pos - 1, pos); // selecting the just typed '"'
        SendMessage(hSci, SCI_REPLACESEL, 0, (LPARAM)"\"function\""); // replacing the '"' with '"function"'
        SendMessage(hSci, SCI_SETSEL, pos, pos + 8); // selecting the text within the quotes
        return;
      }
      break;
    }
}
</code></pre>
<p dir="auto">This has the following consequences, while doing that in an <em>XML file</em>:</p>
<ul>
<li>when ‘"’ is typed, it is replaced by ‘“function”’ - this is intended and expected;</li>
<li>at the moment when the text ‘“function”’ appears and its part ‘function’ becomes selected, the Auto-Completion Popup is unexpectedly shown.</li>
</ul>
<p dir="auto">Could you suggest why the Auto-Completion Popup is shown and what can I do to prevent it to be shown? Or, at least, to detect that it is shown and then to hide it immediately?</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/27002/auto-completion-popup-is-unexpectedly-shown-when-handling-scn_charadded</link><generator>RSS for Node</generator><lastBuildDate>Mon, 12 Oct 2026 07:23:28 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/27002.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 10 Jul 2025 09:49:29 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Auto-Completion Popup is unexpectedly shown when handling SCN_CHARADDED on Sat, 12 Jul 2025 10:25:02 GMT]]></title><description><![CDATA[<p dir="auto">Eventually, it seems the best solution is to subclass Scintilla’s WndProc (for both Main and Secondary Scintilla window) and to handle WM_CHAR there.<br />
The benefits:</p>
<ul>
<li>no need to bother with Scintilla’s native notifications and their nuances;</li>
<li>full control and clarity of <em>what</em> happens and <em>when</em> it happens: within own WM_CHAR handler, we are able to process a character <em>before</em> it goes to Scintilla and <em>after</em> it goes to Scintilla;</li>
<li>simplified code because all the logic is controlled by you and there is no need to conform to Scintilla’s way of processing the events.</li>
</ul>
]]></description><link>https://community.notepad-plus-plus.org/post/102531</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/102531</guid><dc:creator><![CDATA[Vitalii Dovgan]]></dc:creator><pubDate>Sat, 12 Jul 2025 10:25:02 GMT</pubDate></item><item><title><![CDATA[Reply to Auto-Completion Popup is unexpectedly shown when handling SCN_CHARADDED on Fri, 11 Jul 2025 12:08:34 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ekopalypse" aria-label="Profile: Ekopalypse">@<bdi>Ekopalypse</bdi></a><br />
In terms of XBrackets behavior, the difference between typing and pasting is important.<br />
When a user types ‘[’, XBrackets will autocomplete it with ‘]’.<br />
When a user pastes “[”, XBrackets will not react.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/102513</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/102513</guid><dc:creator><![CDATA[Vitalii Dovgan]]></dc:creator><pubDate>Fri, 11 Jul 2025 12:08:34 GMT</pubDate></item><item><title><![CDATA[Reply to Auto-Completion Popup is unexpectedly shown when handling SCN_CHARADDED on Fri, 11 Jul 2025 11:38:34 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/vitalii-dovgan" aria-label="Profile: Vitalii-Dovgan">@<bdi>Vitalii-Dovgan</bdi></a></p>
<blockquote>
<p dir="auto">being typed or the result of pasting</p>
</blockquote>
<p dir="auto">hmm … I think you need to subclass the Scintilla control and check for the WM_PASTE message. The scintilla api, to my knowledge, has no way of letting you know that. But is it even important to know the difference?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/102512</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/102512</guid><dc:creator><![CDATA[Ekopalypse]]></dc:creator><pubDate>Fri, 11 Jul 2025 11:38:34 GMT</pubDate></item><item><title><![CDATA[Reply to Auto-Completion Popup is unexpectedly shown when handling SCN_CHARADDED on Fri, 11 Jul 2025 09:46:33 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ekopalypse" aria-label="Profile: Ekopalypse">@<bdi>Ekopalypse</bdi></a></p>
<p dir="auto">Thank you, <code>SC_MOD_INSERTCHECK</code> is an interesting way indeed.<br />
In this case, how can I understand whether <code>SC_MOD_INSERTCHECK</code> is the result of a character being typed or the result of pasting from the clipboard?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/102511</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/102511</guid><dc:creator><![CDATA[Vitalii Dovgan]]></dc:creator><pubDate>Fri, 11 Jul 2025 09:46:33 GMT</pubDate></item><item><title><![CDATA[Reply to Auto-Completion Popup is unexpectedly shown when handling SCN_CHARADDED on Fri, 11 Jul 2025 08:08:07 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/vitalii-dovgan" aria-label="Profile: Vitalii-Dovgan">@<bdi>Vitalii-Dovgan</bdi></a></p>
<p dir="auto">I assume you could also use <a href="https://www.scintilla.org/ScintillaDoc.html#SCI_CHANGEINSERTION" rel="nofollow ugc">SCI_CHANGEINSERTION</a> within the modified notification.<br />
To do this, however, you must <a href="https://npp-user-manual.org/docs/plugin-communication/#2141-nppm_addscnmodifiedflags" rel="nofollow ugc">request</a> the necessary additional SC_MOD_INSERTCHECK in nppn_ready.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/102510</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/102510</guid><dc:creator><![CDATA[Ekopalypse]]></dc:creator><pubDate>Fri, 11 Jul 2025 08:08:07 GMT</pubDate></item><item><title><![CDATA[Reply to Auto-Completion Popup is unexpectedly shown when handling SCN_CHARADDED on Thu, 10 Jul 2025 21:16:09 GMT]]></title><description><![CDATA[<p dir="auto">I’m preparing a big update to XBrackets Lite, by the way, hence mentioning the quote characters.<br />
Now it will inherit more functionality from XBrackets for AkelPad.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/102506</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/102506</guid><dc:creator><![CDATA[Vitalii Dovgan]]></dc:creator><pubDate>Thu, 10 Jul 2025 21:16:09 GMT</pubDate></item><item><title><![CDATA[Reply to Auto-Completion Popup is unexpectedly shown when handling SCN_CHARADDED on Thu, 10 Jul 2025 21:07:56 GMT]]></title><description><![CDATA[<p dir="auto">Ah, yes, I believe it is something similar to <code>SetWindowLongPtr</code> with <code>GWLP_WNDPROC</code>. I did it in NppExec many years ago and have forgotten about this approach :)<br />
Well, if there will be no easier option suggested, then I’ll take this way. Thank you!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/102505</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/102505</guid><dc:creator><![CDATA[Vitalii Dovgan]]></dc:creator><pubDate>Thu, 10 Jul 2025 21:07:56 GMT</pubDate></item><item><title><![CDATA[Reply to Auto-Completion Popup is unexpectedly shown when handling SCN_CHARADDED on Thu, 10 Jul 2025 18:23:21 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/vitalii-dovgan" aria-label="Profile: Vitalii-Dovgan">@<bdi>Vitalii-Dovgan</bdi></a> said in <a href="/post/102496">Auto-Completion Popup is unexpectedly shown when handling SCN_CHARADDED</a>:</p>
<blockquote>
<p dir="auto">hint</p>
</blockquote>
<p dir="auto">Well, there is a “nuclear option”…</p>
<p dir="auto">Nothing stops a plugin from using <a href="https://learn.microsoft.com/en-us/windows/win32/api/commctrl/nf-commctrl-setwindowsubclass" rel="nofollow ugc">SetWindowSubclass</a> to subclass the main Notepad++ window in order to intercept and preprocess messages.</p>
<p dir="auto">Example:</p>
<ul>
<li><a href="https://github.com/Coises/ColumnsPlusPlus/blob/d8e2c8bcd9b753852f80422fabae6890e5418003/src/Plugin.cpp#L230" rel="nofollow ugc">set subclass</a></li>
<li><a href="https://github.com/Coises/ColumnsPlusPlus/blob/d8e2c8bcd9b753852f80422fabae6890e5418003/src/Plugin.cpp#L43" rel="nofollow ugc">subclass procedure</a></li>
<li><a href="https://github.com/Coises/ColumnsPlusPlus/blob/d8e2c8bcd9b753852f80422fabae6890e5418003/src/ColumnsPlusPlus.cpp#L530" rel="nofollow ugc">what I’m actually doing (making sure tabstops that might be off screen are set before a rectangular selection paste)</a></li>
</ul>
<p dir="auto">I say “nuclear option” because you really need to be careful that you’re not messing up expectations for some other function or plugin. This should be a last resort, because it leaves you free to mess things up entirely.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/102497</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/102497</guid><dc:creator><![CDATA[Coises]]></dc:creator><pubDate>Thu, 10 Jul 2025 18:23:21 GMT</pubDate></item><item><title><![CDATA[Reply to Auto-Completion Popup is unexpectedly shown when handling SCN_CHARADDED on Thu, 10 Jul 2025 17:47:35 GMT]]></title><description><![CDATA[<p dir="auto">Hmm, yes, Notepad++'s SCN_CHARADDED handler explicitly shows the Auto-Completion Popup:</p>
<pre><code>Buffer* currentBuf = _pEditView-&gt;getCurrentBuffer();
if (currentBuf-&gt;allowAutoCompletion())
{
	AutoCompletion* autoC = isFromPrimary ? &amp;_autoCompleteMain : &amp;_autoCompleteSub;
	bool isColumnMode = _pEditView-&gt;execute(SCI_GETSELECTIONS) &gt; 1; // Multi-Selection || Column mode)
	if (nppGui._matchedPairConf.hasAnyPairsPair() &amp;&amp; !isColumnMode)
		autoC-&gt;insertMatchedChars(notification-&gt;ch, nppGui._matchedPairConf);
	autoC-&gt;update(notification-&gt;ch);
}
</code></pre>
<p dir="auto">And what is even more interesting, the <code>_pluginsManager.notify(notification);</code> sends a <em>copy</em> of the <code>notification</code> to plugins. Which means there’s no sense to modify e.g. <code>notification-&gt;nmhdr.code</code> inside a plugin.<br />
So… Seems I have two options:</p>
<ol>
<li>temporarily tune some settings to make <code>currentBuf-&gt;allowAutoCompletion()</code> return false;</li>
<li>find a way to hide the AutoCompletion Popup if it was shown.</li>
</ol>
<p dir="auto">Some hint or additional advice of how to achieve that would be appreciated.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/102496</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/102496</guid><dc:creator><![CDATA[Vitalii Dovgan]]></dc:creator><pubDate>Thu, 10 Jul 2025 17:47:35 GMT</pubDate></item><item><title><![CDATA[Reply to Auto-Completion Popup is unexpectedly shown when handling SCN_CHARADDED on Thu, 10 Jul 2025 16:58:26 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/vitalii-dovgan" aria-label="Profile: Vitalii-Dovgan">@<bdi>Vitalii-Dovgan</bdi></a> said in <a href="/post/102483">Auto-Completion Popup is unexpectedly shown when handling SCN_CHARADDED</a>:</p>
<blockquote>
<p dir="auto">Could you suggest why the Auto-Completion Popup is shown and what can I do to prevent it to be shown? Or, at least, to detect that it is shown and then to hide it immediately?</p>
</blockquote>
<p dir="auto">I don’t have an answer to your question, but maybe a place to get started.</p>
<p dir="auto">Notepad++ processes Scintilla notifications <a href="https://github.com/notepad-plus-plus/notepad-plus-plus/blob/45ce3418da1e6a906f2fd6c05124aee65ccec2a3/PowerEditor/src/NppBigSwitch.cpp#L2276" rel="nofollow ugc">here</a>; it sends notifications to the plugins first, then sends them to its own processing routines. The routine for SCN_CHARADDED is <a href="https://github.com/notepad-plus-plus/notepad-plus-plus/blob/45ce3418da1e6a906f2fd6c05124aee65ccec2a3/PowerEditor/src/NppNotification.cpp#L195" rel="nofollow ugc">here</a>. The plugin notification routines (<a href="https://github.com/notepad-plus-plus/notepad-plus-plus/blob/45ce3418da1e6a906f2fd6c05124aee65ccec2a3/PowerEditor/src/MISC/PluginsManager/PluginsManager.cpp#L710" rel="nofollow ugc">here</a> calling <a href="https://github.com/notepad-plus-plus/notepad-plus-plus/blob/45ce3418da1e6a906f2fd6c05124aee65ccec2a3/PowerEditor/src/MISC/PluginsManager/PluginsManager.cpp#L680" rel="nofollow ugc">here</a>) copy the notification to make sure the plugin can’t change it.</p>
<p dir="auto">At least that should give you a clue where to look to follow what Notepad++ is doing and see if you can find a way to suppress the unwanted behavior.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/102492</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/102492</guid><dc:creator><![CDATA[Coises]]></dc:creator><pubDate>Thu, 10 Jul 2025 16:58:26 GMT</pubDate></item></channel></rss>