Fix issue of lossing syntax highlighting during "save as"
The new behaviour is: as user set a new syntax highlighting once, the new file extension of "save as" will be ignored. Fixes #1298
This commit is contained in:
parent
675d586840
commit
11accf92e9
|
@ -2789,6 +2789,10 @@ void Notepad_plus::command(int id)
|
||||||
case IDM_LANG_USER :
|
case IDM_LANG_USER :
|
||||||
{
|
{
|
||||||
setLanguage(menuID2LangType(id));
|
setLanguage(menuID2LangType(id));
|
||||||
|
// Manually set language, don't change language even file extension changes.
|
||||||
|
Buffer *buffer = _pEditView->getCurrentBuffer();
|
||||||
|
buffer->langHasBeenSetFromMenu();
|
||||||
|
|
||||||
if (_pDocMap)
|
if (_pDocMap)
|
||||||
{
|
{
|
||||||
_pDocMap->setSyntaxHiliting();
|
_pDocMap->setSyntaxHiliting();
|
||||||
|
|
|
@ -205,7 +205,8 @@ void Buffer::setFileName(const TCHAR *fn, LangType defaultLang)
|
||||||
}
|
}
|
||||||
|
|
||||||
updateTimeStamp();
|
updateTimeStamp();
|
||||||
if (newLang != _lang || _lang == L_USER)
|
|
||||||
|
if (!_hasLangBeenSetFromMenu && (newLang != _lang || _lang == L_USER))
|
||||||
{
|
{
|
||||||
_lang = newLang;
|
_lang = newLang;
|
||||||
doNotify(BufferChangeFilename | BufferChangeLanguage | BufferChangeTimestamp);
|
doNotify(BufferChangeFilename | BufferChangeLanguage | BufferChangeTimestamp);
|
||||||
|
|
|
@ -351,6 +351,8 @@ public:
|
||||||
void setMapPosition(const MapPosition & mapPosition) { _mapPosition = mapPosition; };
|
void setMapPosition(const MapPosition & mapPosition) { _mapPosition = mapPosition; };
|
||||||
MapPosition getMapPosition() const { return _mapPosition; };
|
MapPosition getMapPosition() const { return _mapPosition; };
|
||||||
|
|
||||||
|
void langHasBeenSetFromMenu() { _hasLangBeenSetFromMenu = true; };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int indexOfReference(const ScintillaEditView * identifier) const;
|
int indexOfReference(const ScintillaEditView * identifier) const;
|
||||||
|
|
||||||
|
@ -408,5 +410,7 @@ private:
|
||||||
HANDLE _eventHandle = nullptr;
|
HANDLE _eventHandle = nullptr;
|
||||||
bool _isMonitoringOn = false;
|
bool _isMonitoringOn = false;
|
||||||
|
|
||||||
|
bool _hasLangBeenSetFromMenu = false;
|
||||||
|
|
||||||
MapPosition _mapPosition;
|
MapPosition _mapPosition;
|
||||||
};
|
};
|
Loading…
Reference in New Issue