mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-27 07:44:24 +02:00
Fix warning display for Word char list bug
This commit is contained in:
parent
6a0b7653b0
commit
f3db698166
@ -775,7 +775,7 @@ struct NppGUI final
|
|||||||
void setTabReplacedBySpace(bool b) {_tabReplacedBySpace = b;};
|
void setTabReplacedBySpace(bool b) {_tabReplacedBySpace = b;};
|
||||||
const NewDocDefaultSettings & getNewDocDefaultSettings() const {return _newDocDefaultSettings;};
|
const NewDocDefaultSettings & getNewDocDefaultSettings() const {return _newDocDefaultSettings;};
|
||||||
std::vector<LangMenuItem> _excludedLangList;
|
std::vector<LangMenuItem> _excludedLangList;
|
||||||
bool _isLangMenuCompact = false;
|
bool _isLangMenuCompact = true;
|
||||||
|
|
||||||
PrintSettings _printSettings;
|
PrintSettings _printSettings;
|
||||||
BackupFeature _backup = bak_none;
|
BackupFeature _backup = bak_none;
|
||||||
|
@ -472,9 +472,7 @@ void Finder::gotoFoundLine()
|
|||||||
|
|
||||||
// Then we colourise the double clicked line
|
// Then we colourise the double clicked line
|
||||||
setFinderStyle();
|
setFinderStyle();
|
||||||
//_scintView.execute(SCI_SETLEXER, SCLEX_NULL); // yniq - this line causes a bug!!! (last line suddenly belongs to file header level (?) instead of having level=0x400)
|
|
||||||
// later it affects DeleteResult and gotoNextFoundResult (assertions)
|
|
||||||
// fixed by calling setFinderStyle() in deleteResult()
|
|
||||||
_scintView.execute(SCI_STYLESETEOLFILLED, SCE_SEARCHRESULT_HIGHLIGHT_LINE, true);
|
_scintView.execute(SCI_STYLESETEOLFILLED, SCE_SEARCHRESULT_HIGHLIGHT_LINE, true);
|
||||||
_scintView.execute(SCI_STARTSTYLING, start, STYLING_MASK);
|
_scintView.execute(SCI_STARTSTYLING, start, STYLING_MASK);
|
||||||
_scintView.execute(SCI_SETSTYLING, end - start + 2, SCE_SEARCHRESULT_HIGHLIGHT_LINE);
|
_scintView.execute(SCI_SETSTYLING, end - start + 2, SCE_SEARCHRESULT_HIGHLIGHT_LINE);
|
||||||
|
@ -2889,7 +2889,7 @@ INT_PTR CALLBACK MultiInstDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DelimiterSettingsDlg::detectSpace(const char *text2Check, int & nbSp, int & nbTab)
|
void DelimiterSettingsDlg::detectSpace(const char *text2Check, int & nbSp, int & nbTab) const
|
||||||
{
|
{
|
||||||
nbSp = nbTab = 0;
|
nbSp = nbTab = 0;
|
||||||
for (size_t i = 0; i < strlen(text2Check); ++i)
|
for (size_t i = 0; i < strlen(text2Check); ++i)
|
||||||
@ -3025,6 +3025,20 @@ generic_string DelimiterSettingsDlg::getWarningText(size_t nbSp, size_t nbTab) c
|
|||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DelimiterSettingsDlg::setWarningIfNeed() const
|
||||||
|
{
|
||||||
|
generic_string msg;
|
||||||
|
NppGUI & nppGUI = const_cast<NppGUI &>((NppParameters::getInstance())->getNppGUI());
|
||||||
|
if (not nppGUI._isWordCharDefault)
|
||||||
|
{
|
||||||
|
int nbSp = 0;
|
||||||
|
int nbTab = 0;
|
||||||
|
detectSpace(nppGUI._customWordChars.c_str(), nbSp, nbTab);
|
||||||
|
msg = getWarningText(nbSp, nbTab);
|
||||||
|
}
|
||||||
|
::SetDlgItemText(_hSelf, IDD_STATIC_WORDCHAR_WARNING, msg.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
INT_PTR CALLBACK DelimiterSettingsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
|
INT_PTR CALLBACK DelimiterSettingsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
NppGUI & nppGUI = const_cast<NppGUI &>((NppParameters::getInstance())->getNppGUI());
|
NppGUI & nppGUI = const_cast<NppGUI &>((NppParameters::getInstance())->getNppGUI());
|
||||||
@ -3081,11 +3095,7 @@ INT_PTR CALLBACK DelimiterSettingsDlg::run_dlgProc(UINT message, WPARAM wParam,
|
|||||||
::SendDlgItemMessage(_hSelf, IDC_RADIO_WORDCHAR_CUSTOM, BM_SETCHECK, not nppGUI._isWordCharDefault ? BST_CHECKED : BST_UNCHECKED, 0);
|
::SendDlgItemMessage(_hSelf, IDC_RADIO_WORDCHAR_CUSTOM, BM_SETCHECK, not nppGUI._isWordCharDefault ? BST_CHECKED : BST_UNCHECKED, 0);
|
||||||
::EnableWindow(::GetDlgItem(_hSelf, IDC_WORDCHAR_CUSTOM_EDIT), not nppGUI._isWordCharDefault);
|
::EnableWindow(::GetDlgItem(_hSelf, IDC_WORDCHAR_CUSTOM_EDIT), not nppGUI._isWordCharDefault);
|
||||||
|
|
||||||
int nbSp = 0;
|
setWarningIfNeed();
|
||||||
int nbTab = 0;
|
|
||||||
detectSpace(nppGUI._customWordChars.c_str(), nbSp, nbTab);
|
|
||||||
generic_string msg = getWarningText(nbSp, nbTab);
|
|
||||||
::SetDlgItemText(_hSelf, IDD_STATIC_WORDCHAR_WARNING, msg.c_str());
|
|
||||||
|
|
||||||
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker();
|
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker();
|
||||||
generic_string tip2show = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-tip");
|
generic_string tip2show = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-tip");
|
||||||
@ -3147,15 +3157,7 @@ INT_PTR CALLBACK DelimiterSettingsDlg::run_dlgProc(UINT message, WPARAM wParam,
|
|||||||
char customText[MAX_PATH];
|
char customText[MAX_PATH];
|
||||||
::GetDlgItemTextA(_hSelf, IDC_WORDCHAR_CUSTOM_EDIT, customText, MAX_PATH-1);
|
::GetDlgItemTextA(_hSelf, IDC_WORDCHAR_CUSTOM_EDIT, customText, MAX_PATH-1);
|
||||||
nppGUI._customWordChars = customText;
|
nppGUI._customWordChars = customText;
|
||||||
|
setWarningIfNeed();
|
||||||
int nbSp = 0;
|
|
||||||
int nbTab = 0;
|
|
||||||
detectSpace(customText, nbSp, nbTab);
|
|
||||||
generic_string msg = getWarningText(nbSp, nbTab);
|
|
||||||
::SetDlgItemText(_hSelf, IDD_STATIC_WORDCHAR_WARNING, msg.c_str());
|
|
||||||
|
|
||||||
if (not nppGUI._isWordCharDefault)
|
|
||||||
::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_SETWORDCHARS, 0, 0);
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3183,21 +3185,21 @@ INT_PTR CALLBACK DelimiterSettingsDlg::run_dlgProc(UINT message, WPARAM wParam,
|
|||||||
|
|
||||||
case IDC_RADIO_WORDCHAR_DEFAULT:
|
case IDC_RADIO_WORDCHAR_DEFAULT:
|
||||||
{
|
{
|
||||||
//::SendDlgItemMessage(_hSelf, IDC_RADIO_WORDCHAR_DEFAULT, BM_SETCHECK, BST_CHECKED, 0);
|
|
||||||
::SendDlgItemMessage(_hSelf, IDC_RADIO_WORDCHAR_CUSTOM, BM_SETCHECK, BST_UNCHECKED, 0);
|
::SendDlgItemMessage(_hSelf, IDC_RADIO_WORDCHAR_CUSTOM, BM_SETCHECK, BST_UNCHECKED, 0);
|
||||||
nppGUI._isWordCharDefault = true;
|
nppGUI._isWordCharDefault = true;
|
||||||
::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_SETWORDCHARS, 0, 0);
|
::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_SETWORDCHARS, 0, 0);
|
||||||
::EnableWindow(::GetDlgItem(_hSelf, IDC_WORDCHAR_CUSTOM_EDIT), not nppGUI._isWordCharDefault);
|
::EnableWindow(::GetDlgItem(_hSelf, IDC_WORDCHAR_CUSTOM_EDIT), not nppGUI._isWordCharDefault);
|
||||||
|
::SetDlgItemText(_hSelf, IDD_STATIC_WORDCHAR_WARNING, TEXT(""));
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
case IDC_RADIO_WORDCHAR_CUSTOM:
|
case IDC_RADIO_WORDCHAR_CUSTOM:
|
||||||
{
|
{
|
||||||
::SendDlgItemMessage(_hSelf, IDC_RADIO_WORDCHAR_DEFAULT, BM_SETCHECK, BST_UNCHECKED, 0);
|
::SendDlgItemMessage(_hSelf, IDC_RADIO_WORDCHAR_DEFAULT, BM_SETCHECK, BST_UNCHECKED, 0);
|
||||||
//::SendDlgItemMessage(_hSelf, IDC_RADIO_WORDCHAR_CUSTOM, BM_SETCHECK, BST_CHECKED, 0);
|
|
||||||
nppGUI._isWordCharDefault = false;
|
nppGUI._isWordCharDefault = false;
|
||||||
::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_SETWORDCHARS, 0, 0);
|
::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_SETWORDCHARS, 0, 0);
|
||||||
::EnableWindow(::GetDlgItem(_hSelf, IDC_WORDCHAR_CUSTOM_EDIT), not nppGUI._isWordCharDefault);
|
::EnableWindow(::GetDlgItem(_hSelf, IDC_WORDCHAR_CUSTOM_EDIT), not nppGUI._isWordCharDefault);
|
||||||
|
setWarningIfNeed();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,8 +200,9 @@ private :
|
|||||||
HWND _tip = nullptr;
|
HWND _tip = nullptr;
|
||||||
|
|
||||||
INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
|
INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
|
||||||
void detectSpace(const char *text2Check, int & nbSp, int & nbTab);
|
void detectSpace(const char *text2Check, int & nbSp, int & nbTab) const;
|
||||||
generic_string getWarningText(size_t nbSp, size_t nbTab) const;
|
generic_string getWarningText(size_t nbSp, size_t nbTab) const;
|
||||||
|
void setWarningIfNeed() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SettingsOnCloudDlg : public StaticDialog
|
class SettingsOnCloudDlg : public StaticDialog
|
||||||
|
Loading…
x
Reference in New Issue
Block a user