Skip to content

Enter key is consumed by the Auto-Completion function #8389

@jedio60

Description

@jedio60

Description of the Issue

Users not watching the screen when they type may not get what they type, because 'Enter' keypresses are eaten by the Auto-Completion drop-down box when that is active.

Steps to Reproduce the Issue

  1. Verify that Auto-Completion is enabled, with 'from Nth character' setting value 1 or 2. If the configured value is higher, replace 'bla' below by any word long enough.
  2. Start with a blank document.
  3. Type bla hi bla then press Enter. Then type Line 2.

Expected Behavior

Users unaware of the current Auto-Completion behavior will expect literally what they typed, that is:

bla hi bla
Line 2

Actual Behavior

The 'Enter' keypress is eaten by the Auto-Completion drop-down which appears while typing the 2nd instance of 'bla'. See the screenshot:
Auto-Complete box eating Enter

The resulting text is:

bla hi blaLine 2

Debug Information

Notepad++ v7.8.6 (64-bit)
Build time : Apr 21 2020 - 15:23:03
Path : C:\Program Files\Notepad++\notepad++.exe
Admin mode : OFF
Local Conf mode : OFF
OS Name : Windows 10 Pro (64-bit)
OS Version : 1903
OS Build : 18362.778
Plugins : AnalysePlugin.dll MarkdownViewerPlusPlus.dll mimeTools.dll NppConverter.dll NppExport.dll NppMarkdownPanel.dll XMLTools.dll

Proposed solution

Please note that currently, both the 'Tab' and the 'Enter' keys 'confirm' the Auto-Completion: they insert the selected candidate text.

Proposed solution: add the option to NOT let 'Enter' confirm the Auto-Completion. Then the 'Enter' key press will just go into the edited text, like any other characters. Preferably, even make this the default value for the setting because that helps new users. Of course, keep the 'Tab' key function unmodified (i.e., confirm the selected Auto-Completion candidate).

Expected consequences:

  • You get what you type, even if you don't watch the screen. When the user types 'Enter', the drop-down silently closes, like when typing any character which reduces the Auto-Completion candidates list to zero. So, all typed characters go into the edited text.
  • Existing users who really want to keep using 'Enter' will find their way to the setting to force the old behavior.

About the setting:
The proposed setting could be a checkbox, named: 'Enter' confirms Auto-Completion, default value False. The help text could be like: "If enabled, an 'Enter' key press will insert the selected Auto-Completion candidate, like 'Tab' does. Warning: this can cause you to not get a new line when you type Enter."

Related issues

Relation with issue #6182

[Edit: moments ago, @sasumner wrote about #6182: This is fixed in v. 7.8.7 so I'm going to close this issue.]

Issue #6182 (title: 'Do not autocomplete the word I am editing with itselfself') is about a different part of the Auto-Completion behavior. I suspect that that issue is separate from this one, both in behavior and in implementation, except for the following thing. One suggestion done there is to silently close the Auto-Completion drop-down when any word-ending character is typed. I support that and it seems that the implementation touches the implementation suggested here (namely, the reaction to 'Enter').

Relation with issue #4631

Issue #4631 (title: 'Hitting enter key once does not take me to next line!') is a report about 'Enter' key presses not resulting in a new line being created. According to the steps to reproduce reported there, it seems to be a different cause than the issue of this page.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions