From f3abc30c7af6e5b67e7670df98a9fd82e026d946 Mon Sep 17 00:00:00 2001 From: Vineel Kumar Reddy Kovvuri Date: Mon, 27 Jun 2016 07:34:51 +0530 Subject: [PATCH] Recognize new file type via its file extension when file is created from the command line Closes #2018, fixes #2016 This commit fixes the issue of notepad++ defaulting to 'Normal text file' file type when creating new file form the command like: notepad++.exe new_example_file.cpp --- PowerEditor/src/NppIO.cpp | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/PowerEditor/src/NppIO.cpp b/PowerEditor/src/NppIO.cpp index a8cad2b9..078a783e 100644 --- a/PowerEditor/src/NppIO.cpp +++ b/PowerEditor/src/NppIO.cpp @@ -209,7 +209,6 @@ BufferID Notepad_plus::doOpen(const generic_string& fileName, bool isRecursive, } bool globbing = wcsrchr(longFileName, TCHAR('*')) || wcsrchr(longFileName, TCHAR('?')); - bool isOpenningNewEmptyFile = false; if (!isSnapshotMode) // if not backup mode, or backupfile path is invalid { @@ -229,7 +228,6 @@ BufferID Notepad_plus::doOpen(const generic_string& fileName, bool isRecursive, if (res) { isCreateFileSuccessful = true; - isOpenningNewEmptyFile = true; } else { @@ -300,16 +298,6 @@ BufferID Notepad_plus::doOpen(const generic_string& fileName, bool isRecursive, if (isReadOnly) buf->setUserReadOnly(true); - // if it's a new created file, then use new file default settings - if (isOpenningNewEmptyFile) - { - const NewDocDefaultSettings & ndds = (NppParameters::getInstance()->getNppGUI()).getNewDocDefaultSettings(); - buf->setEncoding(ndds._codepage); - buf->setEolFormat(ndds._format); - buf->setUnicodeMode(ndds._unicodeMode); - buf->setLangType(ndds._lang); - } - // Notify plugins that current file is about to open scnN.nmhdr.code = NPPN_FILEBEFOREOPEN; scnN.nmhdr.idFrom = (uptr_t)buffer;