diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp index 52f21a59..657261f1 100644 --- a/PowerEditor/src/Parameters.cpp +++ b/PowerEditor/src/Parameters.cpp @@ -4102,6 +4102,12 @@ void NppParameters::feedGUIParameters(TiXmlNode *node) { _nppGUI._fileSwitcherWithoutExtColumn = true; } + + optName = element->Attribute(TEXT("backSlashIsEscapeCharacterForSql")); + if (optName && !lstrcmp(optName, TEXT("yes"))) + { + _nppGUI._backSlashIsEscapeCharacterForSql = true; + } } } } @@ -4841,6 +4847,9 @@ bool NppParameters::writeGUIParams() const TCHAR * pStr = _nppGUI._fileSwitcherWithoutExtColumn?TEXT("yes"):TEXT("no"); element->SetAttribute(TEXT("fileSwitcherWithoutExtColumn"), pStr); + + pStr = _nppGUI._backSlashIsEscapeCharacterForSql?TEXT("yes"):TEXT("no"); + element->SetAttribute(TEXT("backSlashIsEscapeCharacterForSql"), pStr); } else if (!lstrcmp(nm, TEXT("sessionExt"))) { @@ -5149,8 +5158,9 @@ bool NppParameters::writeGUIParams() { TiXmlElement *GUIConfigElement = (GUIRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))))->ToElement(); GUIConfigElement->SetAttribute(TEXT("name"), TEXT("MISC")); - + GUIConfigElement->SetAttribute(TEXT("fileSwitcherWithoutExtColumn"), _nppGUI._fileSwitcherWithoutExtColumn?TEXT("yes"):TEXT("no")); + GUIConfigElement->SetAttribute(TEXT("backSlashIsEscapeCharacterForSql"), _nppGUI._backSlashIsEscapeCharacterForSql?TEXT("yes"):TEXT("no")); } insertDockingParamNode(GUIRoot); return true; diff --git a/PowerEditor/src/Parameters.h b/PowerEditor/src/Parameters.h index ff5e0ae8..c4327d3c 100644 --- a/PowerEditor/src/Parameters.h +++ b/PowerEditor/src/Parameters.h @@ -714,7 +714,7 @@ struct NppGUI _autocStatus(autoc_both), _autocFromLen(1), _funcParams(false), _definedSessionExt(TEXT("")),\ _doesExistUpdater(false), _caretBlinkRate(250), _caretWidth(1), _enableMultiSelection(false), _shortTitlebar(false), _themeName(TEXT("")), _isLangMenuCompact(false),\ _smartHiliteCaseSensitive(false), _leftmostDelimiter('('), _rightmostDelimiter(')'), _delimiterSelectionOnEntireDocument(false), _multiInstSetting(monoInst),\ - _fileSwitcherWithoutExtColumn(false), _isSnapshotMode(true), _snapshotBackupTiming(7000) { + _fileSwitcherWithoutExtColumn(false), _isSnapshotMode(true), _snapshotBackupTiming(7000), _backSlashIsEscapeCharacterForSql(true) { _appPos.left = 0; _appPos.top = 0; _appPos.right = 700; @@ -765,6 +765,7 @@ struct NppGUI bool _styleMRU; char _leftmostDelimiter, _rightmostDelimiter; bool _delimiterSelectionOnEntireDocument; + bool _backSlashIsEscapeCharacterForSql; // 0 : do nothing diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.h b/PowerEditor/src/ScitillaComponent/ScintillaEditView.h index 29d3f0a7..fea3ba7c 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.h +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.h @@ -715,7 +715,8 @@ protected: void setSqlLexer() { - execute(SCI_SETPROPERTY, (WPARAM)"sql.backslash.escapes", (LPARAM)"1"); + if(NppParameters::getInstance()->getNppGUI()._backSlashIsEscapeCharacterForSql) + execute(SCI_SETPROPERTY, (WPARAM)"sql.backslash.escapes", (LPARAM)"1"); setLexer(SCLEX_SQL, L_SQL, LIST_0); }; diff --git a/PowerEditor/src/WinControls/Preference/preference.rc b/PowerEditor/src/WinControls/Preference/preference.rc index f297fc5e..49a89e5a 100644 --- a/PowerEditor/src/WinControls/Preference/preference.rc +++ b/PowerEditor/src/WinControls/Preference/preference.rc @@ -130,6 +130,7 @@ BEGIN CONTROL "Auto-indent",IDC_CHECK_MAINTAININDENT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,130,150,10 CONTROL "Minimize to system tray",IDC_CHECK_MIN2SYSTRAY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,145,150,10 CONTROL "Show only filename in title bar",IDC_CHECK_SHORTTITLE,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,37,160,217,10 + CONTROL "Backslash is escape character for SQL",IDC_CHECK_BACKSLASHISESCAPECHARACTERFORSQL, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,175,217,10 CONTROL "Enable",IDC_CHECK_CLICKABLELINK_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,267,15,140,10 CONTROL "No underline",IDC_CHECK_CLICKABLELINK_NOUNDERLINE, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,267,28,140,10 diff --git a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp index 6c4b1d98..ed2f72ec 100644 --- a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp +++ b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp @@ -830,6 +830,7 @@ BOOL CALLBACK SettingsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM) ::SendDlgItemMessage(_hSelf, IDC_CHECK_MIN2SYSTRAY, BM_SETCHECK, nppGUI._isMinimizedToTray, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_DETECTENCODING, BM_SETCHECK, nppGUI._detectEncoding, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_AUTOUPDATE, BM_SETCHECK, nppGUI._autoUpdateOpt._doAutoUpdate, 0); + ::SendDlgItemMessage(_hSelf, IDC_CHECK_BACKSLASHISESCAPECHARACTERFORSQL, BM_SETCHECK, nppGUI._backSlashIsEscapeCharacterForSql, 0); ::ShowWindow(::GetDlgItem(_hSelf, IDC_CHECK_AUTOUPDATE), nppGUI._doesExistUpdater?SW_SHOW:SW_HIDE); @@ -1049,6 +1050,12 @@ BOOL CALLBACK SettingsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM) ::SendMessage(grandParent, NPPM_INTERNAL_UPDATETITLEBAR, 0, 0); return TRUE; } + + case IDC_CHECK_BACKSLASHISESCAPECHARACTERFORSQL : + { + nppGUI._backSlashIsEscapeCharacterForSql = isCheckedOrNot(IDC_CHECK_BACKSLASHISESCAPECHARACTERFORSQL); + return TRUE; + } } } } diff --git a/PowerEditor/src/WinControls/Preference/preference_rc.h b/PowerEditor/src/WinControls/Preference/preference_rc.h index 0edd1470..173d8d04 100644 --- a/PowerEditor/src/WinControls/Preference/preference_rc.h +++ b/PowerEditor/src/WinControls/Preference/preference_rc.h @@ -159,6 +159,7 @@ #define IDC_CHECK_SMARTHILITECASESENSITIVE (IDD_PREFERENCE_SETTING_BOX + 32) #define IDC_SMARTHILITING_STATIC (IDD_PREFERENCE_SETTING_BOX + 33) #define IDC_CHECK_DETECTENCODING (IDD_PREFERENCE_SETTING_BOX + 34) + #define IDC_CHECK_BACKSLASHISESCAPECHARACTERFORSQL (IDD_PREFERENCE_SETTING_BOX + 35) //-- FLS: xFileEditViewHistoryParameterGUI: Additional Checkbox for enabling the history for restoring the edit view per file. #define IDC_PREFERENCE_OFFSET_FLS 40 #define IDC_CHECK_REMEMBEREDITVIEWPERFILE (IDD_PREFERENCE_SETTING_BOX + IDC_PREFERENCE_OFFSET_FLS + 1)