From 5bc3ccf469ad18bedbdccc79b562d3419b81cd17 Mon Sep 17 00:00:00 2001 From: Don HO Date: Wed, 31 Mar 2021 03:55:09 +0200 Subject: [PATCH] Fix dragged out UDL file is not applied to UDL in the new instance The workaround is: in case of UDL, "-lLANG" argument part is ignored. We let new instance detect the user lang type via file extension - it works in the most of case, except if user applies an UDL manually. For example, this workaround won't work under the following situation: user applies Markdown to a file named "myMarkdown.abc". Fix #3451 --- PowerEditor/src/Notepad_plus.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index f777b7854..bb5c23811 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -4203,8 +4203,18 @@ void Notepad_plus::docOpenInNewInstance(FileTransferMode mode, int x, int y) command += pY; } - command += TEXT(" -l"); - command += ScintillaEditView::langNames[buf->getLangType()].lexerName; + LangType lt = buf->getLangType(); + + // In case of UDL, "-lLANG" argument part is ignored. + // We let new instance detect the user lang type via file extension - + // it works in the most of case, except if user applies an UDL manually. + // For example, this workaround won't work under the following situation: + // user applies Markdown to a file named "myMarkdown.abc". + if (lt != L_USER) + { + command += TEXT(" -l"); + command += ScintillaEditView::langNames[lt].lexerName; + } command += TEXT(" -n"); command += to_wstring(_pEditView->getCurrentLineNumber() + 1); command += TEXT(" -c");