Fix language detected from content not applied if default language is set
Properly handle missing file extensions in `Buffer::setFileName`
Before 6263ce5
, the user-preferred default language would apply to
files with no extension, but got overwritten by `L_TEXT` when the
extension was present *but unknown*.
This is why the `buf->_lang == L_TEXT` condition failed *only for
buffers with _no_ extension*.
Fix #11504, close #12286
This commit is contained in:
parent
af0bc2e113
commit
a610387fb4
|
@ -211,6 +211,8 @@ void Buffer::setFileName(const TCHAR *fn, LangType defaultLang)
|
|||
newLang = nppParamInst.getLangFromExt(ext);
|
||||
}
|
||||
}
|
||||
else if (!isUntitled()) // existing file with no extension
|
||||
newLang = L_TEXT;
|
||||
|
||||
if (newLang == defaultLang || newLang == L_TEXT) //language can probably be refined
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue