From d1fbe42443dfbdfaa9ded46fcd39f3cb93c93167 Mon Sep 17 00:00:00 2001 From: GoaLitiuM Date: Wed, 26 May 2021 22:00:45 +0300 Subject: [PATCH] Use verbatim strings in tooltip descriptions Additionally escapes backslashes in the tooltip string. Only character that needs to be manually escaped is the double quotation marks. --- Source/Engine/Input/KeyboardKeys.h | 2 +- Source/Tools/Flax.Build/Bindings/BindingsGenerator.CSharp.cs | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Source/Engine/Input/KeyboardKeys.h b/Source/Engine/Input/KeyboardKeys.h index fe6daa12b..12f79ea1f 100644 --- a/Source/Engine/Input/KeyboardKeys.h +++ b/Source/Engine/Input/KeyboardKeys.h @@ -745,7 +745,7 @@ API_ENUM() enum class KeyboardKeys LeftBracket = 0xDB, /// - /// Used for miscellaneous characters; it can vary by keyboard. For the US standard keyboard the '\\|' key + /// Used for miscellaneous characters; it can vary by keyboard. For the US standard keyboard the '\|' key /// Backslash = 0xDC, diff --git a/Source/Tools/Flax.Build/Bindings/BindingsGenerator.CSharp.cs b/Source/Tools/Flax.Build/Bindings/BindingsGenerator.CSharp.cs index 26fa55231..cff6be5a5 100644 --- a/Source/Tools/Flax.Build/Bindings/BindingsGenerator.CSharp.cs +++ b/Source/Tools/Flax.Build/Bindings/BindingsGenerator.CSharp.cs @@ -469,9 +469,8 @@ namespace Flax.Build.Bindings if (comment[i - 1].StartsWith("/// ")) tooltip += " " + comment[i - 1].Substring(4); } - if (tooltip.IndexOf('\"') != -1) - tooltip = tooltip.Replace("\"", "\\\""); - contents.Append(indent).Append("[Tooltip(\"").Append(tooltip).Append("\")]").AppendLine(); + tooltip = tooltip.Replace("\"", "\"\""); + contents.Append(indent).Append("[Tooltip(@\"").Append(tooltip).Append("\")]").AppendLine(); } } if (writeDefaultValue)