mirror of
				https://github.com/notepad-plus-plus/notepad-plus-plus.git
				synced 2025-11-03 21:14:08 +01:00 
			
		
		
		
	Make "Prevent C0 input" feature optional
This commit is contained in:
		
							parent
							
								
									40adc38201
								
							
						
					
					
						commit
						35deb8a303
					
				@ -1008,7 +1008,7 @@ Translation note:
 | 
				
			|||||||
					<Item id="6254" name="Abbreviation"/>
 | 
										<Item id="6254" name="Abbreviation"/>
 | 
				
			||||||
					<Item id="6255" name="Codepoint"/>
 | 
										<Item id="6255" name="Codepoint"/>
 | 
				
			||||||
					<Item id="6256" name="Custom Color"/>
 | 
										<Item id="6256" name="Custom Color"/>
 | 
				
			||||||
					<Item id="6258" name="Apply appearance settings to C0, C1 && Unicode EOL"/>
 | 
										<Item id="6258" name="Apply Appearance settings to C0, C1 && Unicode EOL"/>
 | 
				
			||||||
					<Item id="6259" name="Prevent control character (C0 code) typing into document"/>
 | 
										<Item id="6259" name="Prevent control character (C0 code) typing into document"/>
 | 
				
			||||||
				</Scintillas2>
 | 
									</Scintillas2>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1008,7 +1008,7 @@ Translation note:
 | 
				
			|||||||
					<Item id="6254" name="Abbreviation"/>
 | 
										<Item id="6254" name="Abbreviation"/>
 | 
				
			||||||
					<Item id="6255" name="Codepoint"/>
 | 
										<Item id="6255" name="Codepoint"/>
 | 
				
			||||||
					<Item id="6256" name="Custom Color"/>
 | 
										<Item id="6256" name="Custom Color"/>
 | 
				
			||||||
					<Item id="6258" name="Apply appearance settings to C0, C1 && Unicode EOL"/>
 | 
										<Item id="6258" name="Apply Appearance settings to C0, C1 && Unicode EOL"/>
 | 
				
			||||||
					<Item id="6259" name="Prevent control character (C0 code) typing into document"/>
 | 
										<Item id="6259" name="Prevent control character (C0 code) typing into document"/>
 | 
				
			||||||
				</Scintillas2>
 | 
									</Scintillas2>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1006,7 +1006,7 @@ Translation note:
 | 
				
			|||||||
					<Item id="6254" name="Abréviation"/>
 | 
										<Item id="6254" name="Abréviation"/>
 | 
				
			||||||
					<Item id="6255" name="Point de code"/>
 | 
										<Item id="6255" name="Point de code"/>
 | 
				
			||||||
					<Item id="6256" name="Couleur personnalisée"/>
 | 
										<Item id="6256" name="Couleur personnalisée"/>
 | 
				
			||||||
					<Item id="6258" name="Appliquer l'apparence à C0, C1 & Unicode EOL"/>
 | 
										<Item id="6258" name="Appliquer les paramètres d'Apparence à C0, C1 & Unicode EOL"/>
 | 
				
			||||||
					<Item id="6259" name="Empêcher la saisie de caractères de contrôle (code C0) dans le document"/>
 | 
										<Item id="6259" name="Empêcher la saisie de caractères de contrôle (code C0) dans le document"/>
 | 
				
			||||||
				</Scintillas2>
 | 
									</Scintillas2>
 | 
				
			||||||
				<DarkMode title="Mode Sombre">
 | 
									<DarkMode title="Mode Sombre">
 | 
				
			||||||
 | 
				
			|||||||
@ -6569,6 +6569,7 @@ void NppParameters::feedScintillaParam(TiXmlNode *node)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	_svp._npcCustomColor = parseYesNoBoolAttribute(TEXT("npcCustomColor"));
 | 
						_svp._npcCustomColor = parseYesNoBoolAttribute(TEXT("npcCustomColor"));
 | 
				
			||||||
	_svp._npcIncludeCcUniEol = parseYesNoBoolAttribute(TEXT("npcIncludeCcUniEOL"));
 | 
						_svp._npcIncludeCcUniEol = parseYesNoBoolAttribute(TEXT("npcIncludeCcUniEOL"));
 | 
				
			||||||
 | 
						_svp._npcNoInputC0 = parseYesNoBoolAttribute(TEXT("npcNoInputC0"));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// C0, C1 control and Unicode EOL visibility state
 | 
						// C0, C1 control and Unicode EOL visibility state
 | 
				
			||||||
	_svp._ccUniEolShow = parseYesNoBoolAttribute(TEXT("ccShow"), true);
 | 
						_svp._ccUniEolShow = parseYesNoBoolAttribute(TEXT("ccShow"), true);
 | 
				
			||||||
@ -6905,6 +6906,7 @@ bool NppParameters::writeScintillaParams()
 | 
				
			|||||||
	(scintNode->ToElement())->SetAttribute(TEXT("npcMode"), static_cast<int>(_svp._npcMode));
 | 
						(scintNode->ToElement())->SetAttribute(TEXT("npcMode"), static_cast<int>(_svp._npcMode));
 | 
				
			||||||
	setYesNoBoolAttribute(TEXT("npcCustomColor"), _svp._npcCustomColor);
 | 
						setYesNoBoolAttribute(TEXT("npcCustomColor"), _svp._npcCustomColor);
 | 
				
			||||||
	setYesNoBoolAttribute(TEXT("npcIncludeCcUniEOL"), _svp._npcIncludeCcUniEol);
 | 
						setYesNoBoolAttribute(TEXT("npcIncludeCcUniEOL"), _svp._npcIncludeCcUniEol);
 | 
				
			||||||
 | 
						setYesNoBoolAttribute(TEXT("npcNoInputC0"), _svp._npcNoInputC0);
 | 
				
			||||||
	setYesNoBoolAttribute(TEXT("ccShow"), _svp._ccUniEolShow);
 | 
						setYesNoBoolAttribute(TEXT("ccShow"), _svp._ccUniEolShow);
 | 
				
			||||||
	(scintNode->ToElement())->SetAttribute(TEXT("borderWidth"), _svp._borderWidth);
 | 
						(scintNode->ToElement())->SetAttribute(TEXT("borderWidth"), _svp._borderWidth);
 | 
				
			||||||
	(scintNode->ToElement())->SetAttribute(TEXT("smoothFont"), _svp._doSmoothFont ? TEXT("yes") : TEXT("no"));
 | 
						(scintNode->ToElement())->SetAttribute(TEXT("smoothFont"), _svp._doSmoothFont ? TEXT("yes") : TEXT("no"));
 | 
				
			||||||
 | 
				
			|||||||
@ -967,6 +967,7 @@ struct ScintillaViewParams
 | 
				
			|||||||
	bool _npcCustomColor = false;
 | 
						bool _npcCustomColor = false;
 | 
				
			||||||
	bool _npcIncludeCcUniEol = false;
 | 
						bool _npcIncludeCcUniEol = false;
 | 
				
			||||||
	bool _ccUniEolShow = true;
 | 
						bool _ccUniEolShow = true;
 | 
				
			||||||
 | 
						bool _npcNoInputC0 = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	int _borderWidth = 2;
 | 
						int _borderWidth = 2;
 | 
				
			||||||
	bool _virtualSpace = false;
 | 
						bool _virtualSpace = false;
 | 
				
			||||||
 | 
				
			|||||||
@ -501,7 +501,8 @@ LRESULT ScintillaEditView::scintillaNew_Proc(HWND hwnd, UINT Message, WPARAM wPa
 | 
				
			|||||||
		{
 | 
							{
 | 
				
			||||||
			// prevent "control characters" from being entered in text
 | 
								// prevent "control characters" from being entered in text
 | 
				
			||||||
			// (don't need to be concerned about Tab or CR or LF etc here)
 | 
								// (don't need to be concerned about Tab or CR or LF etc here)
 | 
				
			||||||
			if ((wParam >= 0 && wParam <= 31) || wParam == 127)
 | 
								if ((NppParameters::getInstance()).getSVP()._npcNoInputC0 &&
 | 
				
			||||||
 | 
									((wParam >= 0 && wParam <= 31) || wParam == 127))
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				return FALSE;
 | 
									return FALSE;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
				
			|||||||
@ -126,8 +126,8 @@ BEGIN
 | 
				
			|||||||
    CONTROL         "Codepoint",IDC_RADIO_NPC_CODEPOINT,"Button",BS_AUTORADIOBUTTON,33,116,110,10
 | 
					    CONTROL         "Codepoint",IDC_RADIO_NPC_CODEPOINT,"Button",BS_AUTORADIOBUTTON,33,116,110,10
 | 
				
			||||||
    CONTROL         "Custom Color",IDC_CHECK_NPC_COLOR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,33,133,110,10
 | 
					    CONTROL         "Custom Color",IDC_CHECK_NPC_COLOR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,33,133,110,10
 | 
				
			||||||
    PUSHBUTTON      "...",IDC_BUTTON_NPC_LAUNCHSTYLECONF,147,130,16,14
 | 
					    PUSHBUTTON      "...",IDC_BUTTON_NPC_LAUNCHSTYLECONF,147,130,16,14
 | 
				
			||||||
    CONTROL         "Apply appearance settings to C0, C1 && Unicode EOL",IDC_CHECK_NPC_INCLUDECCUNIEOL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,153,281,10
 | 
					    CONTROL         "Apply Appearance settings to C0, C1 && Unicode EOL",IDC_CHECK_NPC_INCLUDECCUNIEOL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,153,281,10
 | 
				
			||||||
    //CONTROL         "Prevent control character (C0 code) typing into document",IDC_CHECK_NPC_NOC0CODETYPING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,177,281,10
 | 
					    CONTROL         "Prevent control character (C0 code) typing into document", IDC_CHECK_NPC_NOINPUTC0,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,177,281,10
 | 
				
			||||||
END
 | 
					END
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1182,6 +1182,7 @@ intptr_t CALLBACK Editing2SubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
			setChecked(IDC_CHECK_NPC_COLOR, svp._npcCustomColor);
 | 
								setChecked(IDC_CHECK_NPC_COLOR, svp._npcCustomColor);
 | 
				
			||||||
			setChecked(IDC_CHECK_NPC_INCLUDECCUNIEOL, svp._npcIncludeCcUniEol);
 | 
								setChecked(IDC_CHECK_NPC_INCLUDECCUNIEOL, svp._npcIncludeCcUniEol);
 | 
				
			||||||
 | 
								setChecked(IDC_CHECK_NPC_NOINPUTC0, svp._npcNoInputC0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			generic_string tipNote2Show = pNativeSpeaker->getLocalizedStrFromID("npcNote-tip",
 | 
								generic_string tipNote2Show = pNativeSpeaker->getLocalizedStrFromID("npcNote-tip",
 | 
				
			||||||
				L"Representation of selected \"non-ASCII\" whitespace and non-printing (control) characters.\n\n"\
 | 
									L"Representation of selected \"non-ASCII\" whitespace and non-printing (control) characters.\n\n"\
 | 
				
			||||||
@ -1370,6 +1371,12 @@ intptr_t CALLBACK Editing2SubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA
 | 
				
			|||||||
					::SendMessage(grandParent, NPPM_INTERNAL_SETNPC, IDC_CHECK_NPC_INCLUDECCUNIEOL, 0);
 | 
										::SendMessage(grandParent, NPPM_INTERNAL_SETNPC, IDC_CHECK_NPC_INCLUDECCUNIEOL, 0);
 | 
				
			||||||
					return TRUE;
 | 
										return TRUE;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									case IDC_CHECK_NPC_NOINPUTC0:
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										svp._npcNoInputC0 = isCheckedOrNot(IDC_CHECK_NPC_NOINPUTC0);
 | 
				
			||||||
 | 
										return TRUE;
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		return TRUE;
 | 
							return TRUE;
 | 
				
			||||||
 | 
				
			|||||||
@ -166,7 +166,7 @@
 | 
				
			|||||||
	#define	IDC_CHECK_NPC_COLOR (IDD_PREFERENCE_SUB_EDITING + 56)
 | 
						#define	IDC_CHECK_NPC_COLOR (IDD_PREFERENCE_SUB_EDITING + 56)
 | 
				
			||||||
	#define	IDC_BUTTON_NPC_LAUNCHSTYLECONF (IDD_PREFERENCE_SUB_EDITING + 57)
 | 
						#define	IDC_BUTTON_NPC_LAUNCHSTYLECONF (IDD_PREFERENCE_SUB_EDITING + 57)
 | 
				
			||||||
	#define	IDC_CHECK_NPC_INCLUDECCUNIEOL (IDD_PREFERENCE_SUB_EDITING + 58)
 | 
						#define	IDC_CHECK_NPC_INCLUDECCUNIEOL (IDD_PREFERENCE_SUB_EDITING + 58)
 | 
				
			||||||
	#define	IDC_CHECK_NPC_NOC0CODETYPING (IDD_PREFERENCE_SUB_EDITING + 59)
 | 
						#define	IDC_CHECK_NPC_NOINPUTC0 (IDD_PREFERENCE_SUB_EDITING + 59)
 | 
				
			||||||
	#define	IDC_STATIC_NPC_APPEARANCE (IDD_PREFERENCE_SUB_EDITING + 60)
 | 
						#define	IDC_STATIC_NPC_APPEARANCE (IDD_PREFERENCE_SUB_EDITING + 60)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define	IDD_PREFERENCE_SUB_DELIMITER 6250 //(IDD_PREFERENCE_BOX + 250)
 | 
					#define	IDD_PREFERENCE_SUB_DELIMITER 6250 //(IDD_PREFERENCE_BOX + 250)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user