Fix tab settings not working in javascript
When tab settings exists only for L_JS (the old settings) but if the current document is L_JAVASCRIPT, tab settings for L_JS won't apply to L_JAVASCRIPT document. The fix is to use L_JS's tab settings for both L_JS and L_JAVASCRIPT documents, and to synchronize the values of both type while user modifies javascript tab settings.
This commit is contained in:
parent
08bc46ddfa
commit
8e43715baf
@ -3040,6 +3040,13 @@ void ScintillaEditView::setTabSettings(Lang *lang)
|
||||
{
|
||||
if (lang && lang->_tabSize != -1 && lang->_tabSize != 0)
|
||||
{
|
||||
if (lang->_langID == L_JAVASCRIPT)
|
||||
{
|
||||
Lang *ljs = _pParameter->getLangFromID(L_JS);
|
||||
execute(SCI_SETTABWIDTH, ljs->_tabSize);
|
||||
execute(SCI_SETUSETABS, !ljs->_isTabReplacedBySpace);
|
||||
return;
|
||||
}
|
||||
execute(SCI_SETTABWIDTH, lang->_tabSize);
|
||||
execute(SCI_SETUSETABS, !lang->_isTabReplacedBySpace);
|
||||
}
|
||||
|
@ -1811,6 +1811,17 @@ INT_PTR CALLBACK TabSettings::run_dlgProc(UINT Message, WPARAM wParam, LPARAM/*
|
||||
{
|
||||
Lang *lang = pNppParam->getLangFromIndex(index - 1);
|
||||
if (!lang) return FALSE;
|
||||
if (lang->_langID == L_JS)
|
||||
{
|
||||
Lang *ljs = pNppParam->getLangFromID(L_JAVASCRIPT);
|
||||
ljs->_tabSize = size;
|
||||
}
|
||||
else if (lang->_langID == L_JAVASCRIPT)
|
||||
{
|
||||
Lang *ljavascript = pNppParam->getLangFromID(L_JS);
|
||||
ljavascript->_tabSize = size;
|
||||
}
|
||||
|
||||
lang->_tabSize = size;
|
||||
|
||||
// write in langs.xml
|
||||
@ -1836,6 +1847,18 @@ INT_PTR CALLBACK TabSettings::run_dlgProc(UINT Message, WPARAM wParam, LPARAM/*
|
||||
if (!lang) return FALSE;
|
||||
if (!lang->_tabSize || lang->_tabSize == -1)
|
||||
lang->_tabSize = nppGUI._tabSize;
|
||||
|
||||
if (lang->_langID == L_JS)
|
||||
{
|
||||
Lang *ljs = pNppParam->getLangFromID(L_JAVASCRIPT);
|
||||
ljs->_isTabReplacedBySpace = isTabReplacedBySpace;
|
||||
}
|
||||
else if (lang->_langID == L_JAVASCRIPT)
|
||||
{
|
||||
Lang *ljavascript = pNppParam->getLangFromID(L_JS);
|
||||
ljavascript->_isTabReplacedBySpace = isTabReplacedBySpace;
|
||||
}
|
||||
|
||||
lang->_isTabReplacedBySpace = isTabReplacedBySpace;
|
||||
|
||||
// write in langs.xml
|
||||
|
Loading…
Reference in New Issue
Block a user