Is there an existing issue for this?
Is the issue reproducible in Notepad++ without plugin?
Is the issue reproducible in portable version of Notepad++?
Does the issue affect SciTE?
Description of the Issue
I encountered a situation (there might be others): In a .cpp file, when an if or while statement does not have curly braces, and you type the { character on the next line, it incorrectly adds an extra TAB character of indentation.
@donho The Smart Indentation (Advanced Indentation) feature has many bugs based on my testing. Many situations are not considered, such as brace matching errors, indentation errors when braces are missing, and failing to ignore comments in the code, etc.
Here is a sample file: sample.cpp.zip
Steps To Reproduce
- Paste the following code into the editor and set the language to "C++".
void function(const wchar_t* str)
{
if (str)
return str;
}
- On line 5, type the
{ character. This will automatically add 3 levels of indentation, and the file content will look like this:
void function(const wchar_t* str)
{
if (str)
return str;
{
}
- Paste the following code into the editor and set the language to "C++".
void function(const wchar_t* str)
{
if (str) {
}
- Press Enter to the right of
if (str). This will automatically add 3 levels of indentation, and the file content will look like this:
void function(const wchar_t* str)
{
if (str)
{
}
- Paste the following code into the editor and set the language to "C++".
void function(const wchar_t* str)
{
if (str) { /*This is a comment*/
}
- Press Enter to the right of
/*This is a comment*/. This will automatically add 2 levels of indentation, and the file content will look like this:
void function(const wchar_t* str)
{
if (str) { /*This is a comment*/
}
Current Behavior
In these specific cases, there will be too many or too few TAB characters.
Expected Behavior
The indentation should follow the standards used by software like Visual Studio and others.
Debug Information
Notepad++ v8.9.2 (64-bit)
Build time: Feb 13 2026 - 02:47:53
Scintilla/Lexilla included: 5.5.8/5.4.6
Boost Regex included: 1_90
pugixml included: 1.15
nlohmann JSON included: 3.12.0
Path: C:\Program Files\Notepad++\notepad++.exe
Command Line:
Admin mode: ON
Local Conf mode: OFF
Cloud Config: OFF
Periodic Backup: ON
Placeholders: OFF
Scintilla Rendering Mode: SC_TECHNOLOGY_DIRECTWRITE (1)
Multi-instance Mode: monoInst
asNotepad: OFF
File Status Auto-Detection: cdEnabledNew (for current file/tab only)
Dark Mode: OFF
Display Info:
primary monitor: 1920x1200, scaling 100%
visible monitors count: 1
installed Display Class adapters:
0000: Description - Intel(R) Graphics
0000: DriverVersion - 32.0.101.8247
OS Name: Windows 11 Enterprise (64-bit)
OS Version: 23H2
OS Build: 22631.6783
Current ANSI codepage: 1252
Plugins:
mimeTools (3.1)
Anything else?
No response
Is there an existing issue for this?
Is the issue reproducible in Notepad++ without plugin?
Is the issue reproducible in portable version of Notepad++?
Does the issue affect SciTE?
Description of the Issue
I encountered a situation (there might be others): In a .cpp file, when an
iforwhilestatement does not have curly braces, and you type the{character on the next line, it incorrectly adds an extra TAB character of indentation.@donho The Smart Indentation (Advanced Indentation) feature has many bugs based on my testing. Many situations are not considered, such as brace matching errors, indentation errors when braces are missing, and failing to ignore comments in the code, etc.
Here is a sample file: sample.cpp.zip
Steps To Reproduce
{character. This will automatically add 3 levels of indentation, and the file content will look like this:if (str). This will automatically add 3 levels of indentation, and the file content will look like this:/*This is a comment*/. This will automatically add 2 levels of indentation, and the file content will look like this:Current Behavior
In these specific cases, there will be too many or too few TAB characters.
Expected Behavior
The indentation should follow the standards used by software like Visual Studio and others.
Debug Information
Anything else?
No response