<?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[Special characters with unmapped &quot;shortcut&quot; combos]]></title><description><![CDATA[<p dir="auto">Take a fresh portable Notepad++ 8.6 64-bit (older is fine, this is not a new behavior) and open it.</p>
<p dir="auto">View =&gt; Show Symbol =&gt; Show All Characters</p>
<p dir="auto">Now type <code>SHIFT+CTRL+A</code> and you should get a <code>SOH</code> “icon”:</p>
<p dir="auto"><img src="/assets/uploads/files/1701111970500-a283bf3d-c333-4392-a028-d588c79fee51-image.png" alt="a283bf3d-c333-4392-a028-d588c79fee51-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">I pressed the key-combo 3 times.</p>
<p dir="auto">If you now alias the <code>SHIFT+CTRL+A</code> to a shortcut:</p>
<p dir="auto">Settings =&gt; Shortcut Mapper…</p>
<p dir="auto"><img src="/assets/uploads/files/1701112087834-ba37f279-4981-4fc9-9a98-c0fd18b59af2-image.png" alt="ba37f279-4981-4fc9-9a98-c0fd18b59af2-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">anything at all, it really doesn’t matter … subsequent <code>SHIFT+CTRL+A</code> will no longer insert the <code>SOH</code> character but will perform the shortcut (as expected).</p>
<p dir="auto">The question is - can we prevent non-assigned shortcut-like key combos (e.g., <code>SHIFT+CTRL+A</code>) from inserting invisible special characters if they are not mapped to a shortcut?  Sometimes I find myself fat-fingering a shortcut combo I have mapped and accidentally type one that is not mapped and I get these special characters inserted which causes all types of problems with certain languages and validators.</p>
<p dir="auto">Cheers.</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/25179/special-characters-with-unmapped-shortcut-combos</link><generator>RSS for Node</generator><lastBuildDate>Mon, 20 Jul 2026 08:07:11 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/25179.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 27 Nov 2023 19:10:50 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Special characters with unmapped &quot;shortcut&quot; combos on Thu, 11 Apr 2024 14:05:21 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/kuzduk-kuzduk" aria-label="Profile: kuzduk-kuzduk">@<bdi>kuzduk-kuzduk</bdi></a>,</p>
<p dir="auto">You earlier said,</p>
<blockquote>
<p dir="auto">i dont understand why Don Ho do not off by default this Special characters with unmapped “shortcut”…</p>
</blockquote>
<p dir="auto">And now you say</p>
<blockquote>
<p dir="auto">Thanks, but this doesn’t work for me because I’m using npp 8.5.8</p>
</blockquote>
<p dir="auto">I am sorry.</p>
<p dir="auto">Some applications use a model where they are able to release patch fixes to old releases of software; Notepad++ does not work that way.  If there are bug fixes, they go in the next revision.  So, to be able to get a fix, you have to be willing to update to a new version.</p>
<p dir="auto">(Yes, I said “willing” , not “able”, because despite your assertion, your <em>choice</em> to not upgrade Notepad++ instead of <em>choosing</em> to remap the weird PauseBreak global shortcut to something other than PauseBreak is just that… your choice. And it’s your choice to prioritize keeping PauseBreak over keeping )</p>
<blockquote>
<p dir="auto">so sad, but [Alan’s script does] not work in russian layout</p>
</blockquote>
<p dir="auto">As an alternative, figure out all the <code>Ctrl</code> sequences that type ASCII control characters based on your setup.  Then create a NULL macro for each of those.  A “NULL macro” is a “do nothing” macro.  The scintilla action 2172 is a do-nothing/no-op/null-op action.  So, you could insert a macro like the following into <code>shortcuts.xml</code>, then save and restart:</p>
<pre><code>&lt;Macro name="NULL-CTRL-R" Ctrl="yes" Alt="no" Shift="no" Key="82" FolderName="Control Remaps"&gt;
    &lt;Action type="0" message="2172" wParam="0" lParam="0" sParam="" /&gt;
&lt;/Macro&gt;
</code></pre>
<p dir="auto">This mapped macro it would stop <code>Ctrl+R</code> from inserting the <code>DC2</code> ASCII 18 control character, and instead run a no-op command, making it “do nothing”.</p>
<p dir="auto">Creating multiple such macros, one for each unmapped sequence, would get rid of the accidental ASCII control characters in your documents.  (And I showed putting it in <code>FolderName="Control Remaps"</code>, so they would all show up in a sub-menu of <strong>Macros</strong> instead of cluttering your main <strong>Macros</strong> menu)</p>
<p dir="auto">-----</p>
<p dir="auto"><em>update</em>: earlier in this discussion, <a class="plugin-mentions-user plugin-mentions-a" href="/user/michael-vincent" aria-label="Profile: Michael-Vincent">@<bdi>Michael-Vincent</bdi></a> linked to <a href="/topic/11233">this old discussion</a>.  It turns out, my suggestion is essentially what <a href="https://community.notepad-plus-plus.org/post/13773">Claudia suggested</a> 8 years ago (good to know that her excellent answers have apparently become part of my subconscious mind), though she chose message 0 instead of 2172.  And in this February’s replies to that ancient thread, <a class="plugin-mentions-user plugin-mentions-a" href="/user/mkupper" aria-label="Profile: mkupper">@<bdi>mkupper</bdi></a> <a href="https://community.notepad-plus-plus.org/post/92614">showed a mapping</a> with lots of macros that show how to do the “one macro for each unmapped sequence” that I just suggested today.  (Though I would again recommend changing to 2172, and I’d add the FolderName attribute to de-clutter the Macro menu.)  And <a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: Alan-Kilborn">@<bdi>Alan-Kilborn</bdi></a> <a href="https://community.notepad-plus-plus.org/post/92622">already made</a> the <code>2172</code> correction in that other discussion.  So basically, it turns out I said nothing new anywhere in the second half of this post of mine. ;-)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/94196</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/94196</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Thu, 11 Apr 2024 14:05:21 GMT</pubDate></item><item><title><![CDATA[Reply to Special characters with unmapped &quot;shortcut&quot; combos on Thu, 11 Apr 2024 13:48:21 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/kuzduk-kuzduk" aria-label="Profile: kuzduk-kuzduk">@<bdi>kuzduk-kuzduk</bdi></a> said in <a href="/post/94192">Special characters with unmapped "shortcut" combos</a>:</p>
<blockquote>
<p dir="auto">so sad, but it not work in russian layout: russian keys А…Я not typed symbols in npp 8.5.8.</p>
</blockquote>
<p dir="auto">I don’t know what this means, exactly, since I don’t have familiarity with Russian keyboard and their characters that might be different from a US keyboard.</p>
<blockquote>
<p dir="auto">May be this script can be modified for given this drawback?</p>
</blockquote>
<p dir="auto">Perhaps, but that modification would have to be made by you.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/94194</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/94194</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Thu, 11 Apr 2024 13:48:21 GMT</pubDate></item><item><title><![CDATA[Reply to Special characters with unmapped &quot;shortcut&quot; combos on Thu, 11 Apr 2024 13:52:29 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/kuzduk-kuzduk" aria-label="Profile: kuzduk-kuzduk">@<bdi>kuzduk-kuzduk</bdi></a> said in <a href="/post/94191">Special characters with unmapped "shortcut" combos</a>:</p>
<blockquote>
<p dir="auto">Thanks, but this doesn’t work for me because I’m using npp 8.5.8</p>
</blockquote>
<p dir="auto">You have to pick your poison on this:  Either use a version that supports the <em>Prevent control character…</em> checkbox, or don’t (and thus you don’t get the functionality).</p>
]]></description><link>https://community.notepad-plus-plus.org/post/94193</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/94193</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Thu, 11 Apr 2024 13:52:29 GMT</pubDate></item><item><title><![CDATA[Reply to Special characters with unmapped &quot;shortcut&quot; combos on Thu, 11 Apr 2024 13:39:58 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: Alan-Kilborn">@<bdi>Alan-Kilborn</bdi></a> <a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: Alan-Kilborn">@<bdi>Alan-Kilborn</bdi></a> so sad, but it not work in russian layout: russian keys А…Я not typed symbols in npp 8.5.8. May be this script can be modidfied for given this drawback?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/94192</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/94192</guid><dc:creator><![CDATA[kuzduk = kuzduk]]></dc:creator><pubDate>Thu, 11 Apr 2024 13:39:58 GMT</pubDate></item><item><title><![CDATA[Reply to Special characters with unmapped &quot;shortcut&quot; combos on Thu, 11 Apr 2024 13:34:19 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: PeterJones">@<bdi>PeterJones</bdi></a> Thanks, but this doesn’t work for me because I’m using npp 8.5.8</p>
<p dir="auto">I can’t use 8.6 and higher because they don’t work correctly with the PauseBreak global hotkey: <a href="https://community.notepad-plus-plus.org/topic/25582/global-">https://community.notepad-plus-plus.org/topic/25582/global-</a> hotkey-pausebreak-not-correct-in-npp-8-6-via-puntoswitcher/3?_=1712842017033</p>
]]></description><link>https://community.notepad-plus-plus.org/post/94191</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/94191</guid><dc:creator><![CDATA[kuzduk = kuzduk]]></dc:creator><pubDate>Thu, 11 Apr 2024 13:34:19 GMT</pubDate></item><item><title><![CDATA[Reply to Special characters with unmapped &quot;shortcut&quot; combos on Thu, 04 Apr 2024 20:39:28 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/kuzduk-kuzduk" aria-label="Profile: kuzduk-kuzduk">@<bdi>kuzduk-kuzduk</bdi></a> said in <a href="/post/94024">Special characters with unmapped "shortcut" combos</a>:</p>
<blockquote>
<p dir="auto">i dont understand why Don Ho do not off by default this  Special characters with unmapped “shortcut”…</p>
</blockquote>
<p dir="auto">For clarification: this <em>used</em> to be a problem, like in November 2023 when this Topic was active.  But Don Ho <a href="/topic/25629">released v8.6.5</a> at the end of March, and that new version contains a fix for this issue, thanks to the work that <a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: Alan-Kilborn">@<bdi>Alan-Kilborn</bdi></a> put into implementing the fix.  So this was fixed before <a class="plugin-mentions-user plugin-mentions-a" href="/user/kuzduk-kuzduk" aria-label="Profile: kuzduk-kuzduk">@<bdi>kuzduk-kuzduk</bdi></a> made this post, though you might not have noticed that in the change list for the recent release.</p>
<p dir="auto">So now, in v8.6.5, there is a new setting <code>Prevent control character (C0 code) typing into document</code>:<br />
<img src="/assets/uploads/files/1712263005523-07efb140-beb1-4cad-a270-36e9023d7527-image.png" alt="07efb140-beb1-4cad-a270-36e9023d7527-image.png" class=" img-fluid img-markdown" /><br />
If you leave it in the default, it will have the old behavior (can type the control codes for unmapped shortcuts); if you checkmark the option, then it will have the desired behavior which was previously obtained through the PythonScript code shared above.  You no longer need to run one of those PythonScript scripts if you use the newest version of Notepad++ with the option enabled.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/94034</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/94034</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Thu, 04 Apr 2024 20:39:28 GMT</pubDate></item><item><title><![CDATA[Reply to Special characters with unmapped &quot;shortcut&quot; combos on Thu, 04 Apr 2024 19:47:26 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/kuzduk-kuzduk" aria-label="Profile: kuzduk-kuzduk">@<bdi>kuzduk-kuzduk</bdi></a> said in <a href="/post/94024">Special characters with unmapped "shortcut" combos</a>:</p>
<blockquote>
<p dir="auto">i dont understand why Don Ho do not off by default this Special characters with unmapped “shortcut”…</p>
</blockquote>
<p dir="auto">When a new feature is added, existing behavior is maintained for the default for the new feature setting.</p>
<p dir="auto">So… in this case, before the ability to control it was added, control characters would be typable.  With the setting in its default state, typable control characters are maintained.<br />
It is only if you set the setting to the non-default state that there is a behavior change.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/94030</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/94030</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Thu, 04 Apr 2024 19:47:26 GMT</pubDate></item><item><title><![CDATA[Reply to Special characters with unmapped &quot;shortcut&quot; combos on Thu, 04 Apr 2024 17:31:44 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: Alan-Kilborn">@<bdi>Alan-Kilborn</bdi></a> it is work! Thank u very much!!!</p>
<p dir="auto">i dont understand why Don Ho do not off by default this  Special characters with unmapped “shortcut”…</p>
]]></description><link>https://community.notepad-plus-plus.org/post/94024</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/94024</guid><dc:creator><![CDATA[kuzduk = kuzduk]]></dc:creator><pubDate>Thu, 04 Apr 2024 17:31:44 GMT</pubDate></item><item><title><![CDATA[Reply to Special characters with unmapped &quot;shortcut&quot; combos on Tue, 28 Nov 2023 00:00:50 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/michael-vincent" aria-label="Profile: Michael-Vincent">@<bdi>Michael-Vincent</bdi></a></p>
<p dir="auto">Should have done Google searching instead of on the forum - my forum search-fu is not quite up to par apparently:</p>
<p dir="auto"><a href="https://community.notepad-plus-plus.org/topic/11233/disable-ascii-control-characters-shortcuts">https://community.notepad-plus-plus.org/topic/11233/disable-ascii-control-characters-shortcuts</a></p>
<p dir="auto">I already have lots of <code>CTRL+SHIFT+</code> keys mapped, the ones I don’t have mapped are:</p>
<ul>
<li>6</li>
<li>B</li>
<li>H</li>
<li>I</li>
</ul>
<p dir="auto">So in my PythonScript startup, I just added:</p>
<pre><code>SCI_NULL = 2172
keys = ['6', 'B', 'H', 'I']
editor.assignCmdKey(7 + (KEYMOD.SHIFT&lt;&lt;16), SCI_NULL) # Shift+ESC (weird that it's 7 and not 27)
for key in keys:
    editor.assignCmdKey(ord(key) + ((KEYMOD.CTRL|KEYMOD.SHIFT)&lt;&lt;16), SCI_NULL)
</code></pre>
<p dir="auto">Cheers.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/90806</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/90806</guid><dc:creator><![CDATA[Michael Vincent]]></dc:creator><pubDate>Tue, 28 Nov 2023 00:00:50 GMT</pubDate></item><item><title><![CDATA[Reply to Special characters with unmapped &quot;shortcut&quot; combos on Mon, 27 Nov 2023 20:00:32 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/michael-vincent" aria-label="Profile: Michael-Vincent">@<bdi>Michael-Vincent</bdi></a></p>
<blockquote>
<p dir="auto">can we prevent non-assigned shortcut-like key combos (e.g., SHIFT+CTRL+A) from inserting invisible special characters if they are not mapped to a shortcut?</p>
</blockquote>
<p dir="auto">Yes, it is possible.</p>
<p dir="auto">Some versions of such a PythonScript have been posted before, but those versions use a callback for when the document is modified, to check for and remove such control characters.  This is okay, but I believe the character goes into the undo buffer, so if you undo a change(s), you could get the character back at some point.</p>
<p dir="auto">The following script is a bit lower level and avoids that possible problem.  I call the script <code>ControlCharsPreventBeingEnteredInText.py</code> and here is its listing:</p>
<pre><code class="language-py"># -*- coding: utf-8 -*-
from __future__ import print_function

#-------------------------------------------------------------------------------

# references:
#  https://community.notepad-plus-plus.org/topic/25179/special-characters-with-unmapped-shortcut-combos    &lt;-- contains the script below
#  https://community.notepad-plus-plus.org/topic/18921/ctrl-e-and-ctrl-shift-alt-not-working
#  possibly the script here: https://community.notepad-plus-plus.org/topic/20471 (see Dec 14, 2020, 4:38 PM posting)
#  https://community.notepad-plus-plus.org/topic/23734
#  https://github.com/notepad-plus-plus/notepad-plus-plus/issues/13279

#-------------------------------------------------------------------------------

from Npp import *
import ctypes
from ctypes import wintypes
import platform

#-------------------------------------------------------------------------------

user32 = ctypes.WinDLL('user32')

try:
    editor1.hwnd
    editor2.hwnd
except AttributeError:
    notepad.hwnd = user32.FindWindowW(u'Notepad++', None)
    editor1.hwnd = user32.FindWindowExW(notepad.hwnd, None, u'Scintilla', None)
    editor2.hwnd = user32.FindWindowExW(notepad.hwnd, editor1.hwnd, u'Scintilla', None)

LRESULT = wintypes.LPARAM

WndProcType = ctypes.WINFUNCTYPE(
    LRESULT,  # return type
    wintypes.HWND, wintypes.UINT, wintypes.WPARAM, wintypes.LPARAM  # arguments
    )

running_32bit = platform.architecture()[0] == '32bit'

SetWindowLong = user32.SetWindowLongW if running_32bit else user32.SetWindowLongPtrW
SetWindowLong.restype = WndProcType
SetWindowLong.argtypes = [wintypes.HWND, wintypes.INT, WndProcType]

GWL_WNDPROC = -4

WM_CHAR = 0x102

#-------------------------------------------------------------------------------

class CCPBEIT(object):

    def __init__(self):

        self.new_editor1_wnd_proc_hook_for_SetWindowLong = WndProcType(self.new_editor1_wnd_proc_hook)
        self.orig_editor1_wnd_proc = SetWindowLong(editor1.hwnd, GWL_WNDPROC, self.new_editor1_wnd_proc_hook_for_SetWindowLong)

        self.new_editor2_wnd_proc_hook_for_SetWindowLong = WndProcType(self.new_editor2_wnd_proc_hook)
        self.orig_editor2_wnd_proc = SetWindowLong(editor2.hwnd, GWL_WNDPROC, self.new_editor2_wnd_proc_hook_for_SetWindowLong)

    def common_editor_wnd_proc_hook(self, hwnd, msg, wParam, lParam):
        retval = True
        if msg == WM_CHAR:
            if 0 &lt;= wParam &lt;= 31 or wParam &gt;= 0x7F:
                retval = False  # set to False if we don't want further processing of this message
        return retval

    def new_editor1_wnd_proc_hook(self, hwnd, msg, wParam, lParam):
        retval = self.common_editor_wnd_proc_hook(hwnd, msg, wParam, lParam)
        if retval: retval = self.orig_editor1_wnd_proc(hwnd, msg, wParam, lParam)
        return retval

    def new_editor2_wnd_proc_hook(self, hwnd, msg, wParam, lParam):
        retval = self.common_editor_wnd_proc_hook(hwnd, msg, wParam, lParam)
        if retval: retval = self.orig_editor2_wnd_proc(hwnd, msg, wParam, lParam)
        return retval

#-------------------------------------------------------------------------------

CCPBEIT()
</code></pre>
<p dir="auto">The script should work under PythonScript2 or PythonScript3, and on 32-bit or 64-bit.</p>
<p dir="auto">To set up the script to run upon Notepad++ startup, modify (user) <code>startup.py</code> to contain the following line:</p>
<p dir="auto"><code>import ControlCharsPreventBeingEnteredInText</code></p>
<p dir="auto">and set PythonScript’s Configuration for <em>Initialisation</em> to be <code>ATSTARTUP</code>.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/90802</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/90802</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Mon, 27 Nov 2023 20:00:32 GMT</pubDate></item></channel></rss>