diff --git a/Build/Changes.txt b/Build/Changes.txt
index aebaad4f1..96a9dde10 100644
--- a/Build/Changes.txt
+++ b/Build/Changes.txt
@@ -33,7 +33,7 @@ UCD - (UCD)ARDET is an Encoding Detector Library
========================================================
-Current BETA/RC Version 5.21.417.(build_#) (2021-04-17)
+Current BETA/RC Version 5.21.419.(build_#) (2021-04-19)
========================================================
--------------------------------------------------------
@@ -60,6 +60,8 @@ NEW:
CHANGES:
--------------------------------------------------------
[.###.#]- .
+[.419.1]- Move some Lexer related functions to other module.
+[.419.1]- Enable compiler warnings level 4 and issue "Warnings as Errors" (for Lexilla, Scintilla, grepWinNP3).
[.417.1]- Remove short-note from wrap around match tooltip.
[.416.1]- Save bookmarks in file history in case of "Save as...".
[.416.1]- Minimize usage of deprecated LCID/LANGID for MiniPath.
@@ -96,6 +98,9 @@ CHANGES:
FIXES:
--------------------------------------------------------
[.###.#]- .
+[.419.1]- Apply provided Scintilla patch.
+[.419.1]- Stream comment for .AU3 files.
+[.419.1]- "grepWinNP3": fix compiler warning Release Win32 (GRE).
[.416.2]- Workaround Scintilla text-rendering bug, if line-number margin width set to 0 (so use 1 instead).
[.416.1]- Save Schema config in case of inifile from scratch.
[.415.1]- Small correction to Line Cut feature (thin selection).
diff --git a/Versions/day.txt b/Versions/day.txt
index 53c86ff4f..7b53aa000 100644
--- a/Versions/day.txt
+++ b/Versions/day.txt
@@ -1 +1 @@
-417
+419
diff --git a/res/Notepad3.exe.manifest.conf b/res/Notepad3.exe.manifest.conf
index 51fd23c4f..d44405353 100644
--- a/res/Notepad3.exe.manifest.conf
+++ b/res/Notepad3.exe.manifest.conf
@@ -3,7 +3,7 @@
Notepad3 beta
diff --git a/src/VersionEx.h b/src/VersionEx.h
index 0c53d526e..3f533955d 100644
--- a/src/VersionEx.h
+++ b/src/VersionEx.h
@@ -8,7 +8,7 @@
#define SAPPNAME "Notepad3"
#define VERSION_MAJOR 5
#define VERSION_MINOR 21
-#define VERSION_REV 417
+#define VERSION_REV 419
#define VERSION_BUILD 1
#define SCINTILLA_VER 501
#define LEXILLA_VER 501
diff --git a/test/test_files/StyleLexers/styleLexKotlin/CommandLine (issue #3343).kt b/test/test_files/StyleLexers/styleLexKotlin/CommandLine (issue #3343).kt
new file mode 100644
index 000000000..18e441f2b
--- /dev/null
+++ b/test/test_files/StyleLexers/styleLexKotlin/CommandLine (issue #3343).kt
@@ -0,0 +1,175 @@
+/*
+ * Use of this source code is governed by the MIT license that can be
+ * found in the LICENSE file.
+ */
+
+package org.rust.cargo.toolchain
+
+import com.intellij.execution.ProgramRunnerUtil
+import com.intellij.execution.RunManagerEx
+import com.intellij.execution.RunnerAndConfigurationSettings
+import com.intellij.execution.configuration.EnvironmentVariablesData
+import com.intellij.execution.executors.DefaultRunExecutor
+import org.rust.cargo.project.model.CargoProject
+import org.rust.cargo.project.model.cargoProjects
+import org.rust.cargo.project.workspace.CargoWorkspace
+import org.rust.cargo.runconfig.command.workingDirectory
+import org.rust.cargo.runconfig.createCargoCommandRunConfiguration
+import org.rust.cargo.runconfig.wasmpack.WasmPackCommandConfiguration
+import org.rust.cargo.runconfig.wasmpack.WasmPackCommandConfigurationType
+import org.rust.stdext.buildList
+import java.io.File
+import java.nio.file.Path
+
+abstract class RsCommandLineBase {
+ abstract val command: String
+ abstract val workingDirectory: Path
+ abstract val redirectInputFrom: File?
+ abstract val additionalArguments: List
+
+ protected abstract fun createRunConfiguration(runManager: RunManagerEx, name: String? = null): RunnerAndConfigurationSettings
+
+ fun run(cargoProject: CargoProject, presentableName: String = command, saveConfiguration: Boolean = true) {
+ val project = cargoProject.project
+ val configurationName = when {
+ project.cargoProjects.allProjects.size > 1 -> "$presentableName [${cargoProject.presentableName}]"
+ else -> presentableName
+ }
+ val runManager = RunManagerEx.getInstanceEx(project)
+ val configuration = createRunConfiguration(runManager, configurationName).apply {
+ if (saveConfiguration) {
+ runManager.setTemporaryConfiguration(this)
+ }
+ }
+ val executor = DefaultRunExecutor.getRunExecutorInstance()
+ ProgramRunnerUtil.executeConfiguration(configuration, executor)
+ }
+}
+
+data class CargoCommandLine(
+ override val command: String, // Can't be `enum` because of custom subcommands
+ override val workingDirectory: Path, // Note that working directory selects Cargo project as well
+ override val additionalArguments: List = emptyList(),
+ override val redirectInputFrom: File? = null,
+ val backtraceMode: BacktraceMode = BacktraceMode.DEFAULT,
+ val channel: RustChannel = RustChannel.DEFAULT,
+ val environmentVariables: EnvironmentVariablesData = EnvironmentVariablesData.DEFAULT,
+ val requiredFeatures: Boolean = true,
+ val allFeatures: Boolean = false,
+ val emulateTerminal: Boolean = false
+) : RsCommandLineBase() {
+
+ override fun createRunConfiguration(runManager: RunManagerEx, name: String?): RunnerAndConfigurationSettings =
+ runManager.createCargoCommandRunConfiguration(this, name)
+
+ /**
+ * Adds [arg] to [additionalArguments] as an positional argument, in other words, inserts [arg] right after
+ * `--` argument in [additionalArguments].
+ * */
+ fun withPositionalArgument(arg: String): CargoCommandLine {
+ val (pre, post) = splitOnDoubleDash()
+ if (arg in post) return this
+ return copy(additionalArguments = pre + "--" + arg + post)
+ }
+
+ /**
+ * Splits [additionalArguments] into parts before and after `--`.
+ * For `cargo run --release -- foo bar`, returns (["--release"], ["foo", "bar"])
+ */
+ fun splitOnDoubleDash(): Pair, List> =
+ org.rust.cargo.util.splitOnDoubleDash(additionalArguments)
+
+ fun prependArgument(arg: String): CargoCommandLine =
+ copy(additionalArguments = listOf(arg) + additionalArguments)
+
+ companion object {
+ fun forTargets(
+ targets: List,
+ command: String,
+ additionalArguments: List = emptyList(),
+ usePackageOption: Boolean = true
+ ): CargoCommandLine {
+ val pkgs = targets.map { it.pkg }
+ // Make sure the selection does not span more than one package.
+ assert(pkgs.map { it.rootDirectory }.distinct().size == 1)
+ val pkg = pkgs.first()
+
+ val targetArgs = targets.distinctBy { it.name }.flatMap { target ->
+ when (target.kind) {
+ CargoWorkspace.TargetKind.Bin -> listOf("--bin", target.name)
+ CargoWorkspace.TargetKind.Test -> listOf("--test", target.name)
+ CargoWorkspace.TargetKind.ExampleBin, is CargoWorkspace.TargetKind.ExampleLib ->
+ listOf("--example", target.name)
+ CargoWorkspace.TargetKind.Bench -> listOf("--bench", target.name)
+ is CargoWorkspace.TargetKind.Lib -> listOf("--lib")
+ CargoWorkspace.TargetKind.CustomBuild,
+ CargoWorkspace.TargetKind.Unknown -> emptyList()
+ }
+ }
+
+ val workingDirectory = if (usePackageOption) {
+ pkg.workspace.contentRoot
+ } else {
+ pkg.rootDirectory
+ }
+
+ val commandLineArguments = buildList {
+ if (usePackageOption) {
+ add("--package")
+ add(pkg.name)
+ }
+ addAll(targetArgs)
+ addAll(additionalArguments)
+ }
+
+ return CargoCommandLine(command, workingDirectory, commandLineArguments)
+ }
+
+ fun forTarget(
+ target: CargoWorkspace.Target,
+ command: String,
+ additionalArguments: List = emptyList(),
+ usePackageOption: Boolean = true
+ ): CargoCommandLine = forTargets(listOf(target), command, additionalArguments, usePackageOption)
+
+ fun forProject(
+ cargoProject: CargoProject,
+ command: String,
+ additionalArguments: List = emptyList(),
+ channel: RustChannel = RustChannel.DEFAULT
+ ): CargoCommandLine = CargoCommandLine(
+ command,
+ workingDirectory = cargoProject.workingDirectory,
+ additionalArguments = additionalArguments,
+ channel = channel
+ )
+
+ fun forPackage(
+ cargoPackage: CargoWorkspace.Package,
+ command: String,
+ additionalArguments: List = emptyList()
+ ): CargoCommandLine = CargoCommandLine(
+ command,
+ workingDirectory = cargoPackage.workspace.manifestPath.parent,
+ additionalArguments = listOf("--package", cargoPackage.name) + additionalArguments
+ )
+ }
+}
+
+data class WasmPackCommandLine(
+ override val command: String,
+ override val workingDirectory: Path,
+ override val additionalArguments: List = emptyList()
+) : RsCommandLineBase() {
+ override val redirectInputFrom: File? = null
+
+ override fun createRunConfiguration(runManager: RunManagerEx, name: String?): RunnerAndConfigurationSettings {
+ val runnerAndConfigurationSettings = runManager.createConfiguration(
+ name ?: command,
+ WasmPackCommandConfigurationType.getInstance().factory
+ )
+ val configuration = runnerAndConfigurationSettings.configuration as WasmPackCommandConfiguration
+ configuration.setFromCmd(this)
+ return runnerAndConfigurationSettings
+ }
+}